stella.parameter
Class DataValue

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.parameter.AbstractParameter
                  extended by stella.parameter.AbstractValue
                      extended by stella.parameter.DataValue
All Implemented Interfaces:
Cloneable, EventListener, DataListener, Parameter, Value, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying
Direct Known Subclasses:
RemoteSensorStub, SensorValue

public abstract class DataValue
extends AbstractValue
implements DataListener

The Parameter representation of a sensor reading. This is a tiny wrapper to funnel DataEvents produced by DataSensors into Parameter variables. The sensor global follows the generic AbstractParameter contract and provides a constructor with a Map object as the single argument. To properly work, this class must provide at least three keys in its properties, namely

This class is a defined abstract, though all methods are declared. This is to emphasize that only its subclasses should be used.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  Object blocking
          Gets true if data is available or if sensor value is non-blocking.
private static boolean DEFBLOCK
          The default blocking behavior.
private static String DEFDATA
          The default data type.
static String DERIVATIVE
          A constant defining raw sensor data as the data source.
static String DERIVATIVEVALUE
          A constant defining raw sensor data as the data source.
static String KEY_BLOCK
          If this key maps to true the get-method blocks till data is available.
static String KEY_DATA
          The key to the data source funneled from the sensor.
static String PREDICT
          A constant defining raw sensor data as the data source.
static String PREDICTVALUE
          A constant defining raw sensor data as the data source.
static String RAW
          A constant defining raw sensor data as the data source.
private  Double sensorvalue
          The last measurement.
static String SMOOTH
          A constant defining raw sensor data as the data source.
static String SMOOTHVALUE
          A constant defining raw sensor data as the data source.
static String VALUE
          A constant defining raw sensor data as the data source.
 
Fields inherited from class stella.parameter.AbstractParameter
KEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWN
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
protected DataValue(Map info)
          Constructs a new sensor global.
 
Method Summary
 void dataAvailable(DataEvent de)
          This method is called by subclasses of the data value to funnel a data event, received either locally or via rmi, to this parameter's value.
 String getString()
          Formats the last sensor reading.
 Number getValue()
          The remote get method of the sensor global.
 Number setValue(Number num)
          Sensor wrapping parameters should not be set externally.
 
Methods inherited from class stella.parameter.AbstractValue
get, set
 
Methods inherited from class stella.parameter.AbstractParameter
createParameter, delivers, exit, getFormatted, getFormatted, getName, getPreserveFile, getString, init, register, rescanned, setName, toString
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, setObject, setProperties, setProperty, stringProperties
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface stella.Parameter
getFormatted, getName
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 
Methods inherited from interface util.Initializable
init
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

KEY_BLOCK

public static final String KEY_BLOCK
If this key maps to true the get-method blocks till data is available.

See Also:
Constant Field Values

KEY_DATA

public static final String KEY_DATA
The key to the data source funneled from the sensor. Valid mappings are RAW, PREDICT, SMOOTH, DERIVATIVE, VALUE, PREDICTVALUE, SMOOTHVALUE, and DERIVATIVEVALUE.

See Also:
Constant Field Values

RAW

public static final String RAW
A constant defining raw sensor data as the data source.

See Also:
Constant Field Values

PREDICT

public static final String PREDICT
A constant defining raw sensor data as the data source.

See Also:
Constant Field Values

SMOOTH

public static final String SMOOTH
A constant defining raw sensor data as the data source.

See Also:
Constant Field Values

DERIVATIVE

public static final String DERIVATIVE
A constant defining raw sensor data as the data source.

See Also:
Constant Field Values

VALUE

public static final String VALUE
A constant defining raw sensor data as the data source.

See Also:
Constant Field Values

PREDICTVALUE

public static final String PREDICTVALUE
A constant defining raw sensor data as the data source.

See Also:
Constant Field Values

SMOOTHVALUE

public static final String SMOOTHVALUE
A constant defining raw sensor data as the data source.

See Also:
Constant Field Values

DERIVATIVEVALUE

public static final String DERIVATIVEVALUE
A constant defining raw sensor data as the data source.

See Also:
Constant Field Values

DEFBLOCK

private static final boolean DEFBLOCK
The default blocking behavior.

See Also:
Constant Field Values

DEFDATA

private static final String DEFDATA
The default data type.

See Also:
Constant Field Values

sensorvalue

private Double sensorvalue
The last measurement.


blocking

private Object blocking
Gets true if data is available or if sensor value is non-blocking.

Constructor Detail

DataValue

protected DataValue(Map info)
Constructs a new sensor global. If the sensor this global should wrap could not be found in the properties, the construction fails with an IllegalArgumentException. Additionally, the properties are scanned for the data source key. If this key is not present or maps to an illegal value, it is (re)mapped to RAW. This guarantees that this key is present and points to a allowed value once the construction phase is finished.

Method Detail

setValue

public Number setValue(Number num)
Sensor wrapping parameters should not be set externally. The only allowed method to set sensor parameters is on the data listener's receiving edge.

Specified by:
setValue in interface Value

getValue

public Number getValue()
The remote get method of the sensor global. Simply returns the result of the AbstractValue.get() method, but transports it remotely.

Specified by:
getValue in interface Value

getString

public String getString()
Formats the last sensor reading. Uses the appropriate number format transported with the data event received.

Specified by:
getString in interface Parameter
Overrides:
getString in class AbstractParameter

dataAvailable

public void dataAvailable(DataEvent de)
This method is called by subclasses of the data value to funnel a data event, received either locally or via rmi, to this parameter's value. The sensor global converts the DataEvent into a single double representing the data type specified in its properties.

Specified by:
dataAvailable in interface DataListener