public abstract class AbstractBehavior extends Object implements Behavior
Proxied.Abstract
Constructor and Description |
---|
AbstractBehavior() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
doValidate()
Does validate this behavior.
|
boolean |
equals(Object other)
Extends comparison to the behaviors chain.
|
<T extends Behavior> |
getBehavior(Class<T> behaviorClass)
Gets the first behavior with the specified Class.
|
protected boolean |
getBooleanInputValue(String key,
boolean defaultValue)
Gets a boolean value for a key, providing a default.
|
protected double |
getDoubleInputValue(String key,
double defaultValue)
Gets a double value for a key, providing a default.
|
protected Optional<ElapsedTime> |
getElapsedInputValue(String key,
Optional<ElapsedTime> defaultValue,
Optional<ElapsedTime> emptyValue)
Gets an elapsed time value for a key, providing a default.
|
BehaviorEntity |
getEntity()
Gets the behavior entity.
|
protected Optional<PointInput> |
getInput(Class<? extends Behavior> behaviorClass,
boolean optional)
Gets the first relation with the specified primary behavior Class.
|
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.
|
protected List<PointRelation> |
getRelations(Class<? extends Behavior> behaviorClass)
Gets all relations with the specified primary behavior class.
|
Optional<Sync> |
getRelationSync()
Gets the relation's sync.
|
Optional<SyncEntity> |
getRelationSyncEntity()
Gets the relation's sync entity.
|
Point |
getResultPoint()
Gets the result point.
|
protected Logger |
getThisLogger()
Gets the logger.
|
protected Transform |
getTransform()
Gets the result point's transform.
|
int |
hashCode() |
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) . |
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,
ProxyEntity proxyEntity)
Sets up the instance for action.
|
void |
tearDown()
Tears down what has been set up.
|
String |
toString() |
void |
trigger(PointValue noticeValue,
Batch batch)
Triggers the computation of results if needed.
|
boolean |
validate()
Validates this behavior.
|
protected boolean |
validateNoResults()
Validates that the point does not have results other than itself on the
same processor.
|
protected boolean |
validateTransform(Class<? extends Transform> supportClass)
Validates the result point's transform.
|
public boolean equals(Object other)
Extends comparison to the behaviors chain.
equals
in class Object
public final <T extends Behavior> Optional<T> getBehavior(Class<T> behaviorClass)
getBehavior
in interface Behavior
T
- The type of the returned value.behaviorClass
- The behavior implementation Class.public final BehaviorEntity getEntity()
public final Point getInputPoint()
getInputPoint
in interface Behavior
public final String getName()
public final Optional<Behavior> getNext()
public final Params getParams()
public final ProxyEntity getProxyEntity()
getProxyEntity
in interface Proxied
public final Optional<PointRelation> getRelation()
getRelation
in interface Behavior
public final Optional<Sync> getRelationSync()
getRelationSync
in interface Behavior
public Optional<SyncEntity> getRelationSyncEntity()
getRelationSyncEntity
in interface Behavior
public Point getResultPoint()
getResultPoint
in interface Behavior
public int hashCode()
hashCode
in class Object
public final boolean isInherited()
isInherited
in interface Behavior
public boolean isInputExtrapolated()
isInputExtrapolated
in interface Behavior
public boolean isInputInterpolated()
isInputInterpolated
in interface Behavior
public boolean isInputRequired()
isInputRequired
in interface Behavior
public boolean isInputValid(PointValue inputValue, ResultValue resultValue)
isInputValid
in interface Behavior
inputValue
- The point value.resultValue
- The result value.public boolean isPrimary()
Primary responsibility invloves mainly the trigger logic.
isPrimary
in interface Behavior
PrimaryBehavior
public boolean isResultFetched(PointValue noticeValue, ResultValue resultValue)
isResultFetched
in interface Behavior
noticeValue
- The triggering point valueresultValue
- The the result value.public boolean isSynchronized()
isSynchronized
in interface Behavior
public 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 Behavior
stamp
- 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 Behavior
resultValue
- 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 Behavior
noticeValue
- A point value acting as potential trigger.batch
- The current batch context.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 final void setInherited(boolean inherited)
setInherited
in interface Behavior
inherited
- A new value for the inherited indicator.public final void setNext(Behavior next)
public final void setRelation(PointRelation relation)
setRelation
in interface Behavior
relation
- The point relation.public boolean setUp(Metadata metadata, ProxyEntity proxyEntity)
public void tearDown()
public String toString()
toString
in class Object
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.
public boolean validate()
@CheckReturnValue protected boolean doValidate()
@CheckReturnValue protected boolean getBooleanInputValue(@Nonnull String key, boolean defaultValue)
key
- The name of the value.defaultValue
- The default value for the key.@CheckReturnValue protected double getDoubleInputValue(@Nonnull String key, double defaultValue)
key
- The name of the value.defaultValue
- The default value for the key.@Nonnull @CheckReturnValue protected Optional<ElapsedTime> getElapsedInputValue(@Nonnull String key, @Nonnull Optional<ElapsedTime> defaultValue, @Nonnull Optional<ElapsedTime> emptyValue)
key
- The name of the value.defaultValue
- The optional default value for the key.emptyValue
- The optional assumed value for empty.@Nonnull @CheckReturnValue protected final Optional<PointInput> getInput(@Nonnull Class<? extends Behavior> behaviorClass, boolean optional)
behaviorClass
- The behavior implementation class.optional
- True if the relation is optional.@Nonnull @CheckReturnValue protected final List<PointRelation> getRelations(@Nonnull Class<? extends Behavior> behaviorClass)
behaviorClass
- The behavior implementation class.@Nonnull @CheckReturnValue protected final Logger getThisLogger()
@Nonnull @CheckReturnValue protected final Transform getTransform()
@CheckReturnValue protected final boolean validateNoResults()
@CheckReturnValue protected final boolean validateTransform(@Nonnull Class<? extends Transform> supportClass)
To be valid, the transform must implement or extend the support class.
supportClass
- The support class.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.