stella.sensor
Class AbstractConversion

java.lang.Object
  extended by util.PropertyContainer
      extended by stella.sensor.AbstractConversion
All Implemented Interfaces:
Serializable, Cloneable, ConvertToPhysical, Initializable, PropertyBearing
Direct Known Subclasses:
AbstractDerivative, DewPointConvert, IdenticalConversion

public abstract class AbstractConversion
extends PropertyContainer
implements ConvertToPhysical, Serializable

The class to dynamically construct ConvertToPhysical instances using a properties object as a constructor. May also be used as a base class for ConvertToPhysical and PhysicalDerivative instances. To allow the definition of the diverse decimal format retrieval methods in both interfaces, the ConvertToPhysical and the PhysicalDerivative interface, all relevant keys and default definitions are present already in this class definition.

To allow the conversion to be transported with the event object, this class also implements the Serializable interface. To keep the serialized version slender, the keys and defaults used are defined transient and are used only during the construction phase to spark the existance of private copies of the required instances.

Note that due to the necessary serialization of conversion classes during data event generation, it is not feasible to implement a conversion class as an inner class.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyContainer
PropertyContainer.URLResource
 
Field Summary
private static String DEFUNIT
          The default unit, an empty string.
private static DecimalFormat DEFVALUEFORMAT
          The default decimal format for the values.
private static DecimalFormat DEFVALUESIGMA
          The default deciaml format for the sigma of the values.
static String KEY_UNIT
          The key pointing to the unit description.
static String KEY_VALUEFORMAT
          The key in the Properties referring to the value data format.
static String KEY_VALUESIGMA
          The key to the format string of the sigma of the value.
private  NumberFormat sigform
          The decimal format instance to render the sigma of the values.
private  String unit
          The serializable unit string.
private  NumberFormat valform
          The decimal format instance to render the values.
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR, KEY_NOINITONCREATE, KEY_RESOURCEBUNDLES
 
Fields inherited from interface util.PropertyBearing
CONFIG, KEY_CLASS, KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
protected AbstractConversion(Map prop)
          Constructs a new command renderer.
 
Method Summary
static ConvertToPhysical createConversion(Map prop)
          Constructs a new scheduling instance using the mapping of the PropertyBearing.KEY_CLASS to the class name to derive the class to instantiate.
 NumberFormat getSigmaValueFormat()
          Returns the decimal format of the sigma of the value.
 String getUnit()
          Returns the unit of the physical meaningful quantity.
 NumberFormat getValueFormat()
          Returns the decimal format of the value.
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, clone, createFrom, createFrom, createFrom, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getLocalClassLoader, getLocalized, getLocalized, getLocalizedString, getLocalizedString, getProperties, getPropertiesToKey, getPropertiesToKey, getProperty, getResource, getResourceAsStream, getResourceFromKey, getResources, has, init, isNew, keyCreate, keyCreate, parseObject, reload, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface stella.sensor.ConvertToPhysical
getDeviation, getPhysical, getRaw
 

Field Detail

KEY_UNIT

public static final transient String KEY_UNIT
The key pointing to the unit description.

See Also:
Constant Field Values

KEY_VALUEFORMAT

public static final transient String KEY_VALUEFORMAT
The key in the Properties referring to the value data format.

See Also:
Constant Field Values

KEY_VALUESIGMA

public static final transient String KEY_VALUESIGMA
The key to the format string of the sigma of the value.

See Also:
Constant Field Values

DEFUNIT

private static final transient String DEFUNIT
The default unit, an empty string.

See Also:
Constant Field Values

DEFVALUEFORMAT

private static final transient DecimalFormat DEFVALUEFORMAT
The default decimal format for the values.


DEFVALUESIGMA

private static final transient DecimalFormat DEFVALUESIGMA
The default deciaml format for the sigma of the values.


unit

private String unit
The serializable unit string.


valform

private NumberFormat valform
The decimal format instance to render the values.


sigform

private NumberFormat sigform
The decimal format instance to render the sigma of the values.

Constructor Detail

AbstractConversion

protected AbstractConversion(Map prop)
Constructs a new command renderer. It has the given properties.

Method Detail

getUnit

public String getUnit()
Returns the unit of the physical meaningful quantity. Required in ConvertToPhysical.

Specified by:
getUnit in interface ConvertToPhysical

getValueFormat

public NumberFormat getValueFormat()
Returns the decimal format of the value. Required in ConvertToPhysical.

Specified by:
getValueFormat in interface ConvertToPhysical

getSigmaValueFormat

public NumberFormat getSigmaValueFormat()
Returns the decimal format of the sigma of the value. Required in ConvertToPhysical.

Specified by:
getSigmaValueFormat in interface ConvertToPhysical

createConversion

public static final ConvertToPhysical createConversion(Map prop)
Constructs a new scheduling instance using the mapping of the PropertyBearing.KEY_CLASS to the class name to derive the class to instantiate. If this property is defined, a new Scheduling instance with the stated class name is created, the supplied properties used as an argument in the constructor. Can throw a lot of exceptions if unsuccessful.