|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
util.rmi.RmiPropertyContainer
util.rmi.AbstractRmiCaster
stella.sensor.AbstractSensor
stella.sensor.TimerTaskSensor
stella.sensor.DataSensor
public abstract class DataSensor
A sensor that produces data events. The main difference to its superclass
is the ability of this sensor to pack the data generated and pass them
as an DataEvent to its registered listeners. On construct,
it scans its property argument for the availability of KEY_REPORT,
which should be mapped to an integer describing the number of
individual data points to omit on listener notification. A
value of zero means that data event generating is prohibited.
If this key is not present, it defaults to DEFREPORT
which is normally
10. As soon as the desired number of measurments is available, the
run methods fork to the report() subroutine, which generates
the data events and passes them to the registered listeners. Please ensure
that the listeners method return immediately, otherwise some measurements
will be lost. If a listener needs heavy processing of data, use a new
thread instead.
This sensor adds the following properties if they are not set already (needs updating!):
DataCaster functionality is automatically bound.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class stella.sensor.TimerTaskSensor |
|---|
TimerTaskSensor.SensorRead |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private int |
count
An integer counting the execution number. |
private Vector |
datalist
The list of DataListeners. |
(package private) static DecimalFormat |
DEFRAWFORMAT
The default raw format String. |
(package private) static int |
DEFREPORT
The default report rate. |
(package private) static DecimalFormat |
DEFSIGMAFORMAT
The default format string for the values. |
static String |
KEY_RAWFORMAT
The key in the Map referring to the raw data format. |
static String |
KEY_REPORT
The name of the key for the report rate in this sensors properties. |
static String |
KEY_SIGMAFORMAT
The key to the sigma-format string. |
private NumberFormat |
rawform
The decimal format for the raw values. |
private int |
reportrate
The packing rate. |
private NumberFormat |
sigform
The decimal format for the raw sigma values. |
| Fields inherited from class stella.sensor.TimerTaskSensor |
|---|
KEY_RESPAWN |
| Fields inherited from class stella.sensor.AbstractSensor |
|---|
KEY_BIND, KEY_BINDNAME, KEY_CONVERT, KEY_DESCRIPTION, KEY_SENSORNAME |
| Fields inherited from class util.rmi.AbstractRmiCaster |
|---|
ALTERNATEHOST, ALTERNATEPORT, KEY_EXPORTPORT, KEY_REGISTRYHOST, KEY_REGISTRYPORT |
| 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 stella.rmi.RmiDataCaster |
|---|
NAMING_EXTENSION |
| 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 |
DataSensor(Map qualify)
Constructs a fully-qualified data sensor. |
| Method Summary | |
|---|---|
void |
addDataListener(DataListener ear)
Adds a DataListener to the registered listeners. |
void |
addRmiDataListener(RmiDataListener ear)
Adds a DataListener to the registered listeners. |
protected void |
conductOneMeasure()
The modified version of the conductOneMeasure() method. |
void |
exit()
Unbind from registry, if bound. |
protected DataEvent |
generateDataEvent()
Takes the last sensor reading and produces a RawDataEvent out of
it. |
NumberFormat |
getRawFormat()
Returns the decimal format of the raw value. |
NumberFormat |
getSigmaFormat()
Returns the decimal format of the sigma of the raw value. |
void |
removeDataListener(DataListener ear)
Removes a DataListener from the registered listeners. |
void |
removeRmiDataListener(RmiDataListener ear)
Removes a DataListener from the registered listeners. |
protected void |
report()
This method is called repeatedly within the normal execution of this thread. |
| Methods inherited from class stella.sensor.TimerTaskSensor |
|---|
cancel, equals, getRawToggleInfo, getReading, getRespawn, getTimeOfRead, hashCode, initSensorTimerTask, isReady, newData, readSensor, regetRaw, setTimeOfRead, validReading |
| Methods inherited from class stella.sensor.AbstractSensor |
|---|
addRmiErrorListener, createSensor, getBindName, getConvert, getSensorDescription, getSensorInitInfo, getSensorName, init, notifyErrorListener, removeRmiErrorListener, setConvert, status, toString |
| Methods inherited from class util.rmi.AbstractRmiCaster |
|---|
bindAlternate, bindToRegistry, bindToRegistry, bindToRegistry, casterExit, casterExit, getBindName, isValid, unbindFromRegistry, unbindFromRegistry |
| Methods inherited from class util.rmi.RmiPropertyContainer |
|---|
containsRemoteProperty, getRemoteProperties, getRemoteProperty, setRemoteProperty |
| 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, rescanned, setObject, setProperties, setProperty, stringProperties |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface util.rmi.RmiCaster |
|---|
bindToRegistry, isValid, unbindFromRegistry |
| Methods inherited from interface stella.sensor.Telemetering |
|---|
validReading |
| 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.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| Field Detail |
|---|
public static final String KEY_REPORT
public static final String KEY_RAWFORMAT
public static final String KEY_SIGMAFORMAT
static final int DEFREPORT
static final DecimalFormat DEFRAWFORMAT
static final DecimalFormat DEFSIGMAFORMAT
private transient Vector datalist
private int count
private int reportrate
private NumberFormat rawform
private NumberFormat sigform
| Constructor Detail |
|---|
protected DataSensor(Map qualify)
size - The maximum number of measurments to keep.group - The ThreadGroup this thread belongs to.name - The name of this thread (sensor).qualify - The Map object describing this sensor.| Method Detail |
|---|
public void exit()
exit in interface ExitCleaningexit in class AbstractSensorpublic void addDataListener(DataListener ear)
DataListener to the registered listeners. If the
argument is null, nothing is changed.
addDataListener in interface DataCasterear - The listener to add.public void removeDataListener(DataListener ear)
DataListener from the registered listeners. If the
argument is null, nothing is changed.
removeDataListener in interface DataCasterear - The listener to remove.
public void addRmiDataListener(RmiDataListener ear)
throws RemoteException
DataListener to the registered listeners. If the
argument is null, nothing is changed.
addRmiDataListener in interface RmiDataCasterear - The listener to add.
RemoteException
public void removeRmiDataListener(RmiDataListener ear)
throws RemoteException
DataListener from the registered listeners. If the
argument is null, nothing is changed.
removeRmiDataListener in interface RmiDataCasterear - The listener to remove.
RemoteExceptionpublic NumberFormat getRawFormat()
public NumberFormat getSigmaFormat()
protected void conductOneMeasure()
conductOneMeasure() method.
Additionally to
the readout of the sensor, the method report() is called as
soon as the desired number of data points is present. If the pack
rate is zero or negative this sensor does not export its reading as
data events.
conductOneMeasure in class TimerTaskSensorprotected void report()
KEY_REPORT
property, this occurs on integer multiples of the readout time.
In the default behaviour, a RawDataEvent is generated and passed
to all registered listeners. Please note that it is important that the
listener's DataListener.dataAvailable(stella.DataEvent) returns immediately,
otherwise some reading cycles will be skipped. No data is reported if
the generateDataEvent() returns null.
protected DataEvent generateDataEvent()
RawDataEvent out of
it. The error of the measurement is set to zero.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||