|
|||||||||
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 | +--de.jaetzold.art.CountSensor
This class represents a Sensor which counts state-transitions. For associating state-transitions with a value to count by itself (without a CountSensorPeer
) it can have a StateDecider
.
StateDecider
Inner Class Summary | |
static class |
CountSensor.AbsoluteStateDifferenceStateDecider
This is the StateDecider used as the default in CountSensor . |
class |
CountSensor.CountSensorPort
A SensorPort for the count-value. |
Inner classes inherited from class de.jaetzold.art.RawSensor |
RawSensor.ValueSensorPort |
Fields inherited from class de.jaetzold.art.StateSensor |
stateDecider |
Fields inherited from class de.jaetzold.art.RawSensor |
changes, precision, precisionSet, propertyChangeEventDescriptor |
Constructor Summary | |
CountSensor()
|
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. |
CountSensor.CountSensorPort |
getCountSensorPort()
Returns a SensorPort for the count-value. |
double |
getCountValue()
Returns the count-value this CountSensor currently has. |
boolean |
getDeliversFloatingPoint()
Tells whether this Sensor delivers discrete values or not. |
boolean |
isIncomingConversionCacheable()
This is not the same as isCacheable() from Conversion or StateDecider. |
void |
resetCount()
Resets the count-value this CountSensor currently has to 0. |
void |
setCount(double count)
Sets the count-value this CountSensor currently has. |
void |
setCountDecider(StateDecider countDecider)
Sets the StateDecider used to associate state-transitions with a value to count by ourselves. |
Methods inherited from class de.jaetzold.art.StateSensor |
getStateDecider, setStateDecider |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CountSensor()
Method Detail |
protected double convertToIncoming(double value)
StateSensor
RawSensor
is used to convert the value. Here the StateDecider
get's called.convertToIncoming
in class StateSensor
de.jaetzold.art.StateSensor
StateSensor.setStateDecider(StateDecider)
public double getCountValue()
CountSensor
currently has.public void setCount(double count)
CountSensor
currently has. This way it can be calibrated to a specific point to count from.resetCount()
public void resetCount()
CountSensor
currently has to 0.setCount(double)
public void connectWith(SensorPort port)
RawSensor
connectWith
in class StateSensor
de.jaetzold.art.RawSensor
RawSensor.ValueSensorPort
,
RawSensor.connectWith(Port)
public void disconnect()
Sensor
disconnect
in class StateSensor
de.jaetzold.art.Sensor
Sensor.connectWith(Port)
public boolean getDeliversFloatingPoint()
RawSensor
getDeliversFloatingPoint
in class StateSensor
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 StateSensor
de.jaetzold.art.RawSensor
RawSensor.isOutgoingConversionCacheable()
,
RawSensor.setIncomingConversionDelegate(Conversion)
,
Conversion.isCacheable()
public void setCountDecider(StateDecider countDecider)
StateDecider
used to associate state-transitions with a value to count by ourselves.
If there is a new value from the peer the given decider is used to calculate the value which should be added to the current count-value. The method StateDecider.nextStateValue(double,double)
is called with the last state as the first argument and the new state as the second. Note: states are computed by the superclass.
Beware, as long as the peer is a CountSensorPeer
the decider isn't called.
CountSensorPeer
,
StateSensor.setStateDecider(StateDecider)
public CountSensor.CountSensorPort getCountSensorPort()
RawSensor.getSensorPort()
,
CountSensor.CountSensorPort
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |