de.jaetzold.util
Interface StateDecider

All Known Implementing Classes:
BinaryOperatorStateDecider, LinkedStateDecider, RangeStateDecider, TransitionMatrixStateDecider, TransitionTableStateDecider, ValueToStateStateDecider, SameStateDecider, SensorStateDecider, RCXRotationFasterCountStateDecider, RCXRotationSensorStateDecider, RCXRotationFastCountStateDecider

public interface StateDecider

This interface can be used as an abstraction of a State-Change-Matrix of a finite state machine. But as it is dynamic it is much more flexible.


Method Summary
 boolean isCacheable()
          Tells whether this instance will in the future produce the same state for the same value argument, independent of the actualState.
 double nextStateValue(double actualState, double value)
          Return the next state.
 

Method Detail

isCacheable

public boolean isCacheable()
Tells whether this instance will in the future produce the same state for the same value argument, independent of the actualState. This can be false first and then true at a later time, but it is not legal to return false here after a return of true in the past, because the true answer before was wrong then.
Returns:
true if this instance guarantees, that any further call to nextStateValue() with the same value-argument returns the same state

nextStateValue

public double nextStateValue(double actualState,
                             double value)
Return the next state. The result may depend on the given actualState and the current value but is allowed to depend on anything else. Be sure to have isCacheable() return a correct result then.
See Also:
isCacheable()