|
||||||||||
| 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
stella.sensor.CumulativeSensor
public abstract class CumulativeSensor
A cumulative sensor cumulates readings. It uses a Shelf
Shelf to store a predefined number of measurements. Further
subclasses may use this history to either conduct smoothing, predicting, or
judging tasks.
A normal sensor outputs only doubles, at approximately fixed intervalls.
To store this in a Shelf, the measurements are converted into Doubles.
Additionally, for the sake of completeness, the individual Dates are
also stored in a Shelf.
This sensor adds the following properties if they are not set already:
Shelf| 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 static boolean |
DEFAVERAGE
Act on average per default. |
private static int |
DEFMEMORY
The default number of readings to keep, if property is not given. |
private static int |
DEFPACK
The default number of readings to pack, if property is not given. |
static String |
KEY_AVERAGE
The name of the key that points to true on average, median if false. |
static String |
KEY_MEMORY
The key in the Map list referring to the number of measurements to keep. |
static String |
KEY_PACK
The name of the key for the pack rate in this sensors properties. |
private Shelf<Double> |
raw
Stores the raw readings of this sensor. |
private Shelf<Date> |
time
Stores the times of the readings. |
| Fields inherited from class stella.sensor.DataSensor |
|---|
DEFRAWFORMAT, DEFREPORT, DEFSIGMAFORMAT, KEY_RAWFORMAT, KEY_REPORT, KEY_SIGMAFORMAT |
| 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 |
CumulativeSensor(Map<String,String> qualify)
Constructs a fully-qualified cumulative sensor, with a given size of measurements to keep. Use of this constructor guarantees that the Map key memory is always set. |
| Method Summary | |
|---|---|
void |
cumulateOne(double r,
Date when)
The interface method for storing one raw data point and its time of measure. |
protected DataEvent |
generateDataEvent()
Takes the last sensor reading and produces a CumulativeDataEvent out of it. |
List<Double> |
getLastRaw(int nr)
The interface method for retrieving the last nr raw measures. |
List<Date> |
getLastTime(int nr)
The interface method for retrieving the last nr measurement times. |
int |
getMaxSize()
Returns the maximum number of datas in the data buffer. |
int |
getMemory()
Returns the memory property as an Integer. |
int |
getSize()
Returns the number of datas in the data buffer. |
protected void |
newData(double raw,
Date time)
Called as new data is available. |
| Methods inherited from class stella.sensor.DataSensor |
|---|
addDataListener, addRmiDataListener, conductOneMeasure, exit, getRawFormat, getSigmaFormat, removeDataListener, removeRmiDataListener, report |
| Methods inherited from class stella.sensor.TimerTaskSensor |
|---|
cancel, equals, getRawToggleInfo, getReading, getRespawn, getTimeOfRead, hashCode, initSensorTimerTask, isReady, 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 stella.sensor.Cumulating |
|---|
getTimeOfRead, regetRaw |
| 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_MEMORY
public static final String KEY_PACK
public static final String KEY_AVERAGE
private static final int DEFMEMORY
private static final int DEFPACK
private static final boolean DEFAVERAGE
private Shelf<Double> raw
private Shelf<Date> time
| Constructor Detail |
|---|
protected CumulativeSensor(Map<String,String> qualify)
group - The ThreadGroup this thread belongs to.name - The name of this thread (sensor).qualify - The Map object describing this sensor.| Method Detail |
|---|
protected void newData(double raw,
Date time)
cumulateOne(double, java.util.Date) method.
newData in class TimerTaskSensor
public void cumulateOne(double r,
Date when)
newData(double, java.util.Date).
cumulateOne in interface Cumulatingraw - The raw measured value.Cumulatingpublic List<Double> getLastRaw(int nr)
getLastRaw in interface CumulatingCumulatingpublic List<Date> getLastTime(int nr)
getLastTime in interface CumulatingCumulatingpublic int getSize()
getSize in interface CumulatingCumulatingpublic int getMaxSize()
getMaxSize in interface CumulatingCumulatingpublic int getMemory()
protected DataEvent generateDataEvent()
CumulativeDataEvent out of it. If the KEY_PACK property
points to a value greater than one, the data event produced is the
average of the last measurments. If the DataSensor.KEY_REPORT and the
KEY_PACK keys both point to the same integer, all data
produced is somehow used. However, if KEY_PACK is bigger than
DataSensor.KEY_REPORT, some data point are used twice, so care should be
taken in handling those keys.
generateDataEvent in class DataSensorCumulativeDataEvent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||