public interface Behavior extends Proxied
Behavior instances are applied to input relations to control the effect of an input on the production of results. They then select the appropriate instances of their input.
Each step first calls a 'prepare' method, usually to request values from the
store. The associated method, trigger(org.rvpf.base.value.PointValue, org.rvpf.metadata.processor.Batch)
or select(org.rvpf.base.value.ResultValue, org.rvpf.metadata.processor.Batch)
is then
called.
An important responsability of behaviors is to validate their context.
BehaviorEntityReference
Proxied.Abstract
Modifier and Type | Method and Description |
---|---|
<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.
|
Optional<Behavior> |
getNext()
Gets the next behavior.
|
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.
|
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
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
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.
|
void |
trigger(PointValue noticeValue,
Batch batch)
Triggers the computation of results if needed.
|
boolean |
validate()
Validates this behavior.
|
@Nonnull @CheckReturnValue <T extends Behavior> Optional<T> getBehavior(@Nonnull Class<T> behaviorClass)
T
- The type of the returned value.behaviorClass
- The behavior implementation Class.@Nonnull @CheckReturnValue BehaviorEntity getEntity()
@Nonnull @CheckReturnValue Point getInputPoint()
@Nonnull @CheckReturnValue Optional<Behavior> getNext()
@Nonnull @CheckReturnValue Optional<PointRelation> getRelation()
@Nonnull @CheckReturnValue Optional<Sync> getRelationSync()
@Nonnull @CheckReturnValue Optional<SyncEntity> getRelationSyncEntity()
@Nonnull @CheckReturnValue Point getResultPoint()
@CheckReturnValue boolean isInherited()
@CheckReturnValue boolean isInputExtrapolated()
@CheckReturnValue boolean isInputInterpolated()
@CheckReturnValue boolean isInputRequired()
@CheckReturnValue boolean isInputValid(@Nonnull PointValue inputValue, @Nonnull ResultValue resultValue)
inputValue
- The point value.resultValue
- The result value.@CheckReturnValue boolean isPrimary()
Primary responsibility invloves mainly the trigger logic.
PrimaryBehavior
@CheckReturnValue boolean isResultFetched(@Nonnull PointValue noticeValue, @Nonnull ResultValue resultValue)
noticeValue
- The triggering point valueresultValue
- The the result value.@CheckReturnValue boolean isSynchronized()
@Nonnull @CheckReturnValue ResultValue newResultValue(@Nonnull 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.
stamp
- The time stamp of the value.@CheckReturnValue boolean prepareSelect(@Nonnull ResultValue resultValue, @Nonnull Batch batch)
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.
resultValue
- The result value to be computed.batch
- The current batch context.@CheckReturnValue boolean prepareTrigger(@Nonnull PointValue noticeValue, @Nonnull Batch batch)
trigger(org.rvpf.base.value.PointValue, org.rvpf.metadata.processor.Batch)
.
Will be called until all the batch behaviors return true.
noticeValue
- A point value acting as potential trigger.batch
- The current batch context.@CheckReturnValue boolean select(@Nonnull ResultValue resultValue, @Nonnull Batch batch)
This is called after all the calls to the prepareSelect(org.rvpf.base.value.ResultValue, org.rvpf.metadata.processor.Batch)
method have returned true.
resultValue
- The result value to be computed.batch
- The current batch context.void setInherited(boolean inherited)
inherited
- A new value for the inherited indicator.void setNext(@Nonnull Behavior next)
next
- The next behavior.void setRelation(@Nonnull PointRelation relation)
relation
- The point relation.void trigger(@Nonnull PointValue noticeValue, @Nonnull Batch batch)
This is called after all the calls to the prepareTrigger(org.rvpf.base.value.PointValue, org.rvpf.metadata.processor.Batch)
method have returned true.
noticeValue
- A point value acting as potential trigger.batch
- The current batch context.@CheckReturnValue boolean validate()
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.