public final class BehaviorEntityReference extends Object implements Behavior
Instances of this class are created while loading the metadata. They establish the behavior chain for a point input without having to instantiate these behaviors.
When the processor service has pruned unused points, the
PointInput.setUp(org.rvpf.metadata.Metadata, java.util.Optional<org.rvpf.metadata.entity.TransformEntity.Arg>) method will be able to shed
these instances, replacing them with the actual behaviors with a single call
to instantiate().
Proxied.Abstract| Constructor and Description |
|---|
BehaviorEntityReference(PointRelation relation,
BehaviorEntity entity,
boolean inherited)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(BehaviorEntityReference reference)
Adds a reference on the behavior chain.
|
<T extends Behavior> |
getBehavior(Class<T> behaviorClass)
Gets the first behavior with the specified Class.
|
BehaviorEntity |
getEntity()
Gets the behavior entity.
|
Point |
getInputPoint()
Gets the input point.
|
String |
getName()
Gets the proxy entity Name.
|
Optional<Behavior> |
getNext()
Gets the next behavior.
|
Params |
getParams()
Gets the proxy entity Params.
|
ProxyEntity |
getProxyEntity()
Gets the proxy entity.
|
Optional<PointRelation> |
getRelation()
Gets the point relation to which this behavior instance is attached.
|
Optional<Sync> |
getRelationSync()
Gets the relation's sync.
|
Optional<SyncEntity> |
getRelationSyncEntity()
Gets the relation's sync entity.
|
Point |
getResultPoint()
Gets the result point.
|
Behavior |
instantiate()
Instantiates the actual behavior.
|
boolean |
isInherited()
Asks if this behavior is inherited.
|
boolean |
isInputExtrapolated()
Asks if an input value should be extrapolated.
|
boolean |
isInputInterpolated()
Asks if an input value should be interpolated.
|
boolean |
isInputRequired()
Asks if an input value is required.
|
boolean |
isInputValid(PointValue inputValue,
ResultValue resultValue)
Asks if a point value is valid for the computation of a result value.
|
boolean |
isPrimary()
Asks if this behavior has primary responsibility.
|
boolean |
isResultFetched(PointValue noticeValue,
ResultValue resultValue)
Asks if result value has been fetched.
|
boolean |
isSynchronized()
Asks if this behavior is synchronized.
|
ResultValue |
newResultValue(Optional<DateTime> stamp)
Returns a new result value.
|
boolean |
prepareSelect(ResultValue resultValue,
Batch batch)
Allows a behavior to prepare for a call to
Behavior.select(org.rvpf.base.value.ResultValue, org.rvpf.metadata.processor.Batch). |
boolean |
prepareTrigger(PointValue noticeValue,
Batch batch)
Allows a behavior to prepare for a call to
Behavior.trigger(org.rvpf.base.value.PointValue, org.rvpf.metadata.processor.Batch). |
BehaviorEntityReference |
primary()
Returns the primary Behavior entity reference.
|
boolean |
select(ResultValue resultValue,
Batch batch)
Selects input values for computing the result.
|
void |
setInherited(boolean inherited)
Sets the inherited indicator.
|
void |
setNext(Behavior next)
Sets the next behavior.
|
void |
setRelation(PointRelation relation)
Sets the point relation to which this behavior instance is attached.
|
boolean |
setUp(Metadata metadata)
Sets up the behaviors in the chain.
|
boolean |
setUp(Metadata metadata,
ProxyEntity proxyEntity)
Sets up the instance for action.
|
void |
tearDown()
Tears down what has been set up.
|
void |
trigger(PointValue noticeValue,
Batch batch)
Triggers the computation of results if needed.
|
boolean |
validate()
Validates this behavior.
|
public BehaviorEntityReference(@Nonnull
PointRelation relation,
@Nonnull
BehaviorEntity entity,
boolean inherited)
relation - The point relation holding the reference.entity - The referenced behavior entity.inherited - The inherited indicator.public void add(@Nonnull
BehaviorEntityReference reference)
reference - The reference to a behavior entity.public <T extends Behavior> Optional<T> getBehavior(Class<T> behaviorClass)
getBehavior in interface BehaviorT - The type of the returned value.behaviorClass - The behavior implementation Class.public BehaviorEntity getEntity()
public Point getInputPoint()
getInputPoint in interface Behaviorpublic String getName()
public Optional<Behavior> getNext()
public Params getParams()
public ProxyEntity getProxyEntity()
getProxyEntity in interface Proxiedpublic Optional<PointRelation> getRelation()
getRelation in interface Behaviorpublic Optional<Sync> getRelationSync()
getRelationSync in interface Behaviorpublic Optional<SyncEntity> getRelationSyncEntity()
getRelationSyncEntity in interface Behaviorpublic Point getResultPoint()
getResultPoint in interface Behavior@Nullable @CheckReturnValue public Behavior instantiate()
This method recreates the behavior chain by creating fresh instances of the actual behavior classes.
public boolean isInherited()
isInherited in interface Behaviorpublic boolean isInputExtrapolated()
isInputExtrapolated in interface Behaviorpublic boolean isInputInterpolated()
isInputInterpolated in interface Behaviorpublic boolean isInputRequired()
isInputRequired in interface Behaviorpublic boolean isInputValid(PointValue inputValue, ResultValue resultValue)
isInputValid in interface BehaviorinputValue - The point value.resultValue - The result value.public boolean isPrimary()
Primary responsibility invloves mainly the trigger logic.
isPrimary in interface BehaviorPrimaryBehaviorpublic boolean isResultFetched(PointValue noticeValue, ResultValue resultValue)
isResultFetched in interface BehaviornoticeValue - The triggering point valueresultValue - The the result value.public boolean isSynchronized()
isSynchronized in interface Behaviorpublic ResultValue newResultValue(Optional<DateTime> stamp)
This method is called when a new result value is needed to allow a behavior to supply a specialized class able to hold behavior-specific informations.
newResultValue in interface Behaviorstamp - The time stamp of the value.public boolean prepareSelect(ResultValue resultValue, Batch batch)
Behavior.select(org.rvpf.base.value.ResultValue, org.rvpf.metadata.processor.Batch).
The result value has been triggered either by this behavior or the behavior of an other input. Will be called until all the batch behaviors return true.
prepareSelect in interface BehaviorresultValue - The result value to be computed.batch - The current batch context.public boolean prepareTrigger(PointValue noticeValue, Batch batch)
Behavior.trigger(org.rvpf.base.value.PointValue, org.rvpf.metadata.processor.Batch).
Will be called until all the batch behaviors return true.
prepareTrigger in interface BehaviornoticeValue - A point value acting as potential trigger.batch - The current batch context.@Nullable @CheckReturnValue public BehaviorEntityReference primary()
This method will return null only when a problem is detected. It will return the first behavior entity reference if no behavior is primary.
When it returns a primary behavior, it is removed from the chain.
public boolean select(ResultValue resultValue, Batch batch)
This is called after all the calls to the Behavior.prepareSelect(org.rvpf.base.value.ResultValue, org.rvpf.metadata.processor.Batch)
method have returned true.
public void setInherited(boolean inherited)
setInherited in interface Behaviorinherited - A new value for the inherited indicator.public void setNext(Behavior next)
public void setRelation(PointRelation relation)
setRelation in interface Behaviorrelation - The point relation.@CheckReturnValue
public boolean setUp(@Nonnull
Metadata metadata)
metadata - The metadata available to the current process.public boolean setUp(Metadata metadata, ProxyEntity proxyEntity)
public void tearDown()
public void trigger(PointValue noticeValue, Batch batch)
This is called after all the calls to the Behavior.prepareTrigger(org.rvpf.base.value.PointValue, org.rvpf.metadata.processor.Batch)
method have returned true.
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.