|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.jaetzold.art.RawSensor | +--de.jaetzold.art.StateSensor
This class interprets the values as a state. That means somehow discrete values. For interpreting values as a state by itself (without a StateSensorPeer
) it can have a StateDecider
.
Be aware that - stricly speaking - a statesenor without a special StateSensorPeer
requires setChangeEventsEnabled(true)
, if the same values can produce different states when received in different states. That is for example the case if we have a TransitiontablestateDecider
. Maybe fix that one day by setting changeEventsEnabled
depending on our own statedeciders personality?
States are not ints because other subclasses do need doubles right now.
StateDecider
,
StateSensorPeer
Inner classes inherited from class de.jaetzold.art.RawSensor |
RawSensor.ValueSensorPort |
Field Summary | |
protected StateDecider |
stateDecider
This is the StateDecider which gets used when we have no StateSensorPeer. |
Fields inherited from class de.jaetzold.art.RawSensor |
changes, precision, precisionSet, propertyChangeEventDescriptor |
Constructor Summary | |
StateSensor()
|
Method Summary | |
void |
connectWith(SensorPort port)
Connects this Sensor with the given Port. |
protected double |
convertToIncoming(double value)
This hook from RawSensor is used to convert the value. |
void |
disconnect()
Disconnects this Sensor from it's Peer and it's Port. |
boolean |
getDeliversFloatingPoint()
Tells whether this Sensor delivers discrete values or not. |
StateDecider |
getStateDecider()
Returns the StateDecider used to interpret values as states by ourselves. |
boolean |
isIncomingConversionCacheable()
This is not the same as isCacheable() from Conversion or StateDecider. |
void |
setStateDecider(StateDecider decider)
Sets the StateDecider used to interpret values as states by ourselves. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected StateDecider stateDecider
ValueToStateStateDecider
.StateSensorPeer
,
ValueToStateStateDecider
Constructor Detail |
public StateSensor()
Method Detail |
public StateDecider getStateDecider()
StateDecider
used to interpret values as states by ourselves.public void setStateDecider(StateDecider decider)
StateDecider
used to interpret values as states by ourselves.
If there is a new value from the peer the given decider is used to calculate the next state with the last state as the first argument to the method StateDecider.nextStateValue(double,double)
and the new value as the second.
Beware, as long as the peer is a StateSensorPeer
the decider isn't called anytime.
StateSensorPeer
protected double convertToIncoming(double value)
RawSensor
is used to convert the value. Here the StateDecider
get's called.convertToIncoming
in class RawSensor
setStateDecider(StateDecider)
public void connectWith(SensorPort port)
RawSensor
connectWith
in class RawSensor
de.jaetzold.art.RawSensor
RawSensor.ValueSensorPort
,
RawSensor.connectWith(Port)
public void disconnect()
Sensor
disconnect
in class RawSensor
de.jaetzold.art.Sensor
Sensor.connectWith(Port)
public boolean getDeliversFloatingPoint()
RawSensor
getDeliversFloatingPoint
in class RawSensor
de.jaetzold.art.RawSensor
RawSensor.convertToIncoming(double)
,
RawSensor.setIncomingConversionDelegate(Conversion)
,
RawSensor.setOutgoingConversionDelegate(Conversion)
public boolean isIncomingConversionCacheable()
RawSensor
isCacheable()
from Conversion or StateDecider. The Conversion may depend on a delegate and that delegate can be set more than once. Therefore it would be impossible to assure that the Conversion remains cacheable. But the contract is, that as long as the delegate doesn't change you can assume that the incoming conversion remains cacheable once it has become so.isIncomingConversionCacheable
in class RawSensor
de.jaetzold.art.RawSensor
RawSensor.isOutgoingConversionCacheable()
,
RawSensor.setIncomingConversionDelegate(Conversion)
,
Conversion.isCacheable()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |