de.jaetzold.art
Class BooleanSensor
java.lang.Object
|
+--de.jaetzold.art.RawSensor
|
+--de.jaetzold.art.StateSensor
|
+--de.jaetzold.art.BooleanSensor
- All Implemented Interfaces:
- EventListener, PropertyChangeListener, Sensor, SensorPeer
- public class BooleanSensor
- extends StateSensor
A class which represents a sensor for two states, false and true.
The state can be retrieved through a call to getBooleanValue()
or by converting the normal sensor value (which comes e.g. with a SensorEvent
) with the method convertToBoolean(double)
.
Methods inherited from class de.jaetzold.art.RawSensor |
addPropertyChangeListener, addSensorListener, addSensorListener, connectWith, convertToOutgoing, disableEvent, enableEvent, getChangeEventsEnabled, getIncomingConversionDelegate, getIntValue, getOutgoingConversionDelegate, getPeer, getPeerCacheEnabled, getPort, getPrecision, getSensorPort, getValue, isConnected, isOutgoingConversionCacheable, isReversed, processEvent, propertyChange, removePropertyChangeListener, removeSensorListener, removeSensorListener, setChangeEventsEnabled, setIncomingConversionDelegate, setOutgoingConversionDelegate, setPeerCacheEnabled, setPrecision, setReversed, update |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BooleanSensor
public BooleanSensor()
getBooleanValue
public boolean getBooleanValue()
- Returns the state of this Sensor as a boolean.
- See Also:
convertToBoolean(double)
convertToBoolean
public boolean convertToBoolean(double value)
- This method is used to convert the double values to boolean. Because it has
public
-access it normal double-values can be used to represent the state of this sensor. They are only converted to boolean if needed. For example as it is the case for interpreting the value of a SensorEvent
which does not cover the boolean-type.
getBooleanConversion
public BooleanConversion getBooleanConversion()
- Returns a
BooleanConversion
which converts doubles to boolean in the exact same way as this BooleanSensor
does. The type of conversion even changes when the one of this BooleanSensor
changes because its convertToBoolean(double)
-method is used for the actual conversion.
- See Also:
convertToBoolean(double)
setBooleanConversionDelegate
public void setBooleanConversionDelegate(BooleanConversion delegate)
- This delegate will be used for the conversion of doubles to boolean.
The boolean value returned from the delegate might be inverted afterwards when the property
alternateReality
is set to true.
- See Also:
convertToBoolean(double)
,
setAlternateReality(boolean)
getBooleanConversionDelegate
public BooleanConversion getBooleanConversionDelegate()
- The delegate used for the conversion of doubles to boolean.
- See Also:
setBooleanConversionDelegate(BooleanConversion)
isAlternateReality
public boolean isAlternateReality()
- Tells whether the acutally computed boolean will be inverted before delivering it to "the outside".
- See Also:
setAlternateReality(boolean)
setAlternateReality
public void setAlternateReality(boolean alternateReality)
- Confgures whether the acutally computed boolean will be inverted before delivering it to "the outside".
This is kind of a "reversed"-property for
BooleanSensor
s.
- See Also:
RawSensor.setReversed(boolean)