stella.sensor
Class WeatherSensor

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by util.rmi.RmiPropertyContainer
                  extended by util.rmi.AbstractRmiCaster
                      extended by stella.sensor.AbstractSensor
                          extended by stella.sensor.TimerTaskSensor
                              extended by stella.sensor.DataSensor
                                  extended by stella.sensor.CumulativeSensor
                                      extended by stella.sensor.PredictiveSensor
                                          extended by stella.sensor.SmoothingSensor
                                              extended by stella.sensor.DerivativeSensor
                                                  extended by stella.sensor.WeatherSensor
All Implemented Interfaces:
Cloneable, Remote, Caster, DataCaster, RmiDataCaster, RmiErrorCaster, Cumulating, Deriving, Predicting, Smoothing, Telemetering, WeatherJudging, WeatherCaster, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, RmiCaster, RmiPropertyBearing
Direct Known Subclasses:
AverageSensor, BadSensor, DewPoint, FakeSensor, HealthSensor, KeystrokeSensor, MoxaSensor, OneWireADSensor, OneWireSensor, ParameterSensor, RS485Sensor, SolHeightSensor, SolZSensor, Ups, UpsSensor

public abstract class WeatherSensor
extends DerivativeSensor
implements WeatherJudging, WeatherCaster

This is the last abstract class in the sensor chain. If WeatherListener are registered to this sensor, they recive a WeatherEvent whenever the weather situation on this sensor changes. Note that a combination of individual weather sensors to a weather station should handle this events via registering itself to all its comprising weather sensors as a weather event listener, and passing a combined event to its registered listeners.

True weather sensors, like a rain sensor, should subclass this method and provide bodies for this methods:

Note that this class does provide default implementations from the methods inherited from the interface WeatherJudging which return false for all values, indicating good weather. This is useful, if your non-abstract subclass can judge the weather only by, say, considering smoothened values. In such a case, you only have to override the badFromSmooth method, while the default implementations will never spoil the overall judging from this sensor.

Note also that this class produces DataEvents with a principal measurement reflecting the current weather conditions.


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 DEFDERIVATIVEINVALID
          The default raw-vote if raw reading is invalid.
private static boolean DEFINVERSE
          The default inverse property.
private static boolean DEFINVERSEDERIVATIVE
          The default inverse-derivative property.
private static boolean DEFPREDICTINVALID
          The default raw-vote if raw reading is invalid.
private static boolean DEFRAWINVALID
          The default raw-vote if raw reading is invalid.
private static long DEFRETARD
          The default retard time for all cases in ms.
private static boolean DEFSMOOTHINVALID
          The default raw-vote if raw reading is invalid.
private  boolean derivativeretard
          An indicator weather is on retard because of a derivative toggle.
private  Toggling derivativetoggle
          The Toggling instance for derivative-value judgement.
private  long derivtime
          The actual retard time intervall for derivative retards.
private  boolean invert
          True if toggling value is inverse of weather value.
private  boolean invertderivative
          True if toggling value is inverse for derivative judgement.
static String KEY_DERIVATIVEINVALID
          The key pointing to the deriv.-vote in case of non-valid readings.
static String KEY_DERIVATIVEPARAMETER
          The key pointing to the parameters of the derivative judgement.
static String KEY_INVERSE
          The key defining if good weather inverses the toggle value.
static String KEY_INVERSEDERIVATIVE
          Defines if good weather inverses the toggle value from the deriv..
static String KEY_JUDGEDERIVATIVE
          The key pointing to the instance for the derivative-value judgement.
static String KEY_JUDGEPREDICT
          The key pointing to the instance for the predicted-value judgement.
static String KEY_JUDGERAW
          The key pointing to the judging-instance for the raw-value judgement.
static String KEY_JUDGESMOOTH
          The key pointing to the instance for the smooth-value judgement.
static String KEY_PREDICTINVALID
          The predictive-vote in case of non-valid readings.
static String KEY_PREDICTPARAMETER
          The key pointing to the parameters of the predicted-value judgement.
static String KEY_RAWINVALID
          The key pointing to the raw-vote in case of non-valid readings.
static String KEY_RAWPARAMETER
          The key pointing to the parameters of the raw-value judgement.
static String KEY_RETARDBADDERIVATIVE
          The key pointing to a retard time for weather changes good->bad.
static String KEY_RETARDBADPREDICT
          The key pointing to a retard time for weather changes good->bad.
static String KEY_RETARDBADRAW
          The key pointing to a retard time for weather changes good->bad.
static String KEY_RETARDBADSMOOTH
          The key pointing to a retard time for weather changes good->bad.
static String KEY_RETARDGOODDERIVATIVE
          The key pointing to a retard time for weather changes bad->good.
static String KEY_RETARDGOODPREDICT
          The key pointing to a retard time for weather changes bad->good.
static String KEY_RETARDGOODRAW
          The key pointing to a retard time for weather changes bad->good.
static String KEY_RETARDGOODSMOOTH
          The key pointing to a retard time for weather changes bad->good.
static String KEY_SMOOTHINVALID
          The key pointing to the smooth-vote in case of non-valid readings.
static String KEY_SMOOTHPARAMETER
          The key pointing to the parameters of the smooth-value judgement.
private  SimpleTrigger lastDerivative
          A trigger holding this sensors last derivative judge.
private  SimpleTrigger lastPredict
          A trigger holding this sensors last predictive judge.
private  SimpleTrigger lastRaw
          A trigger holding this sensors last raw judge.
private  SimpleTrigger lastSmooth
          A trigger holding this sensors last smooth judge.
private  boolean predictretard
          An indicator weather is on retard because of a prediction toggle.
private  long predicttime
          The actual retard time intervall for prediction retards.
private  Toggling predicttoggle
          The Toggling instance for predicted-value judgement.
private  boolean rawretard
          An indicator weather is on retard because of a raw toggle.
private  long rawtime
          The actual retard time intervall for raw retards.
private  Toggling rawtoggle
          The Toggling instance for raw-value judgement.
private  boolean smoothretard
          An indicator weather is on retard because of a smooth toggle.
private  long smoothtime
          The actual retard time intervall for smooth retards.
private  Toggling smoothtoggle
          The Toggling instance for smooth-value judgement.
private  Vector weatherlist
          The list of WeatherListeners.
 
Fields inherited from class stella.sensor.DerivativeSensor
DEFRAWDERIVATIVE, derive, KEY_DERIVATIVEADVISE, KEY_DERIVE, KEY_PATH, KEY_RAWDERIVATIVE, z
 
Fields inherited from class stella.sensor.SmoothingSensor
f, g, KEY_SMOOTH, KEY_SMOOTHADVISE
 
Fields inherited from class stella.sensor.PredictiveSensor
KEY_BASE, KEY_CHI, KEY_EXTRAPOLATE, KEY_FUTURE, KEY_PREDICTADVISE, predict
 
Fields inherited from class stella.sensor.CumulativeSensor
KEY_AVERAGE, KEY_MEMORY, KEY_PACK
 
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 WeatherSensor(Map qualify)
          Constructs a fully-qualified weather sensor.
 
Method Summary
 void addWeatherListener(WeatherListener ear)
          Adds a WeatherListener to the registered listeners.
protected  void conductOneMeasure()
          Adds the judging capabilities to the readout of this sensor.
 boolean currentlyClear()
          Returns true if the weather is currently good.
 boolean currentlyRetarding()
          Are we in a retarding phase?
private  boolean derivativeChange()
          True if a weather event generation should be possible considering the derivative sensor.
protected  DataEvent generateDataEvent()
          Converts the conventional data event into a DataEvent, where the principal measurement reflects the current weather situation.
 long getMinClearUpTime()
          If clear, we return zero.
 String getSensorInitInfo()
          Returns a string description of this sensor.
protected  boolean goodFromDerivative(double derive)
          A default implementation of the method in WeatherJudging.
protected  boolean goodFromPredict(double predict)
          A default implementation of the method in WeatherJudging.
protected  boolean goodFromRaw(double raw)
          A default implementation of the method in WeatherJudging.
protected  boolean goodFromSmooth(double smooth)
          A default implementation of the method in WeatherJudging.
 boolean isDerivativeRetard()
          Returns true if this weather sensor is derivative retarding.
 boolean isPredictRetard()
          Returns true if this weather sensor is predict retarding.
 boolean isRawRetard()
          Returns true if this weather sensor is raw retarding.
 boolean isSmoothRetard()
          Returns true if this weather sensor is smooth retarding.
protected  void judgeWeather()
          This method generates the actual judging of the weather situation.
protected  void notifyWeatherListener(WeatherEvent we)
          Parses through the list of registered weather listeners and passes the argumental weather event to all of them.
private  boolean predictChange()
          True if a weather event generation should be possible considering the predictive sensor.
private  boolean rawChange()
          True if a weather event generation should be possible considering the raw sensor.
 void removeWeatherListener(WeatherListener ear)
          Removes a WeatherListener from the registered listeners.
private  boolean smoothChange()
          True if a weather event generation should be possible considering the smooth sensor.
 String status()
          Adds the current vote to the status message.
 
Methods inherited from class stella.sensor.DerivativeSensor
deriveAt, getDerivativeFormat, getDerivativeToggleInfo, getDerivator, getLastDerivative, isDerivativeAdvise, isDeriving, newData, regetDerive, registerDerivator
 
Methods inherited from class stella.sensor.SmoothingSensor
getLastSmooth, getSmoother, getSmoothToggleInfo, isSmoothAdvise, isSmoothing, regetSmooth, registerSmoother, smoothOne
 
Methods inherited from class stella.sensor.PredictiveSensor
getExtrapolation, getLastPredict, getPredictToggleInfo, isPredictAdvise, isPredicting, isReliable, predictFrom, regetPredict
 
Methods inherited from class stella.sensor.CumulativeSensor
cumulateOne, getLastRaw, getLastTime, getMaxSize, getMemory, getSize
 
Methods inherited from class stella.sensor.DataSensor
addDataListener, addRmiDataListener, 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, getSensorName, init, notifyErrorListener, removeRmiErrorListener, setConvert, 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
cumulateOne, getLastRaw, getLastTime, getMaxSize, getSize, 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

KEY_JUDGERAW

public static final String KEY_JUDGERAW
The key pointing to the judging-instance for the raw-value judgement.

See Also:
Constant Field Values

KEY_RAWPARAMETER

public static final String KEY_RAWPARAMETER
The key pointing to the parameters of the raw-value judgement.

See Also:
Constant Field Values

KEY_RETARDBADRAW

public static final String KEY_RETARDBADRAW
The key pointing to a retard time for weather changes good->bad.

See Also:
Constant Field Values

KEY_RETARDGOODRAW

public static final String KEY_RETARDGOODRAW
The key pointing to a retard time for weather changes bad->good.

See Also:
Constant Field Values

KEY_JUDGESMOOTH

public static final String KEY_JUDGESMOOTH
The key pointing to the instance for the smooth-value judgement.

See Also:
Constant Field Values

KEY_SMOOTHPARAMETER

public static final String KEY_SMOOTHPARAMETER
The key pointing to the parameters of the smooth-value judgement.

See Also:
Constant Field Values

KEY_RETARDBADSMOOTH

public static final String KEY_RETARDBADSMOOTH
The key pointing to a retard time for weather changes good->bad.

See Also:
Constant Field Values

KEY_RETARDGOODSMOOTH

public static final String KEY_RETARDGOODSMOOTH
The key pointing to a retard time for weather changes bad->good.

See Also:
Constant Field Values

KEY_JUDGEDERIVATIVE

public static final String KEY_JUDGEDERIVATIVE
The key pointing to the instance for the derivative-value judgement.

See Also:
Constant Field Values

KEY_DERIVATIVEPARAMETER

public static final String KEY_DERIVATIVEPARAMETER
The key pointing to the parameters of the derivative judgement.

See Also:
Constant Field Values

KEY_RETARDBADDERIVATIVE

public static final String KEY_RETARDBADDERIVATIVE
The key pointing to a retard time for weather changes good->bad.

See Also:
Constant Field Values

KEY_RETARDGOODDERIVATIVE

public static final String KEY_RETARDGOODDERIVATIVE
The key pointing to a retard time for weather changes bad->good.

See Also:
Constant Field Values

KEY_JUDGEPREDICT

public static final String KEY_JUDGEPREDICT
The key pointing to the instance for the predicted-value judgement.

See Also:
Constant Field Values

KEY_PREDICTPARAMETER

public static final String KEY_PREDICTPARAMETER
The key pointing to the parameters of the predicted-value judgement.

See Also:
Constant Field Values

KEY_RETARDBADPREDICT

public static final String KEY_RETARDBADPREDICT
The key pointing to a retard time for weather changes good->bad.

See Also:
Constant Field Values

KEY_RETARDGOODPREDICT

public static final String KEY_RETARDGOODPREDICT
The key pointing to a retard time for weather changes bad->good.

See Also:
Constant Field Values

KEY_INVERSE

public static final String KEY_INVERSE
The key defining if good weather inverses the toggle value.

See Also:
Constant Field Values

KEY_INVERSEDERIVATIVE

public static final String KEY_INVERSEDERIVATIVE
Defines if good weather inverses the toggle value from the deriv..

See Also:
Constant Field Values

KEY_RAWINVALID

public static final String KEY_RAWINVALID
The key pointing to the raw-vote in case of non-valid readings.

See Also:
Constant Field Values

KEY_SMOOTHINVALID

public static final String KEY_SMOOTHINVALID
The key pointing to the smooth-vote in case of non-valid readings.

See Also:
Constant Field Values

KEY_DERIVATIVEINVALID

public static final String KEY_DERIVATIVEINVALID
The key pointing to the deriv.-vote in case of non-valid readings.

See Also:
Constant Field Values

KEY_PREDICTINVALID

public static final String KEY_PREDICTINVALID
The predictive-vote in case of non-valid readings.

See Also:
Constant Field Values

DEFRETARD

private static final long DEFRETARD
The default retard time for all cases in ms.

See Also:
Constant Field Values

DEFINVERSE

private static final boolean DEFINVERSE
The default inverse property.

See Also:
Constant Field Values

DEFINVERSEDERIVATIVE

private static final boolean DEFINVERSEDERIVATIVE
The default inverse-derivative property.

See Also:
Constant Field Values

DEFRAWINVALID

private static final boolean DEFRAWINVALID
The default raw-vote if raw reading is invalid.

See Also:
Constant Field Values

DEFSMOOTHINVALID

private static final boolean DEFSMOOTHINVALID
The default raw-vote if raw reading is invalid.

See Also:
Constant Field Values

DEFDERIVATIVEINVALID

private static final boolean DEFDERIVATIVEINVALID
The default raw-vote if raw reading is invalid.

See Also:
Constant Field Values

DEFPREDICTINVALID

private static final boolean DEFPREDICTINVALID
The default raw-vote if raw reading is invalid.

See Also:
Constant Field Values

lastRaw

private SimpleTrigger lastRaw
A trigger holding this sensors last raw judge.


lastSmooth

private SimpleTrigger lastSmooth
A trigger holding this sensors last smooth judge.


lastDerivative

private SimpleTrigger lastDerivative
A trigger holding this sensors last derivative judge.


lastPredict

private SimpleTrigger lastPredict
A trigger holding this sensors last predictive judge.


rawretard

private boolean rawretard
An indicator weather is on retard because of a raw toggle.


rawtime

private long rawtime
The actual retard time intervall for raw retards.


smoothretard

private boolean smoothretard
An indicator weather is on retard because of a smooth toggle.


smoothtime

private long smoothtime
The actual retard time intervall for smooth retards.


derivativeretard

private boolean derivativeretard
An indicator weather is on retard because of a derivative toggle.


derivtime

private long derivtime
The actual retard time intervall for derivative retards.


predictretard

private boolean predictretard
An indicator weather is on retard because of a prediction toggle.


predicttime

private long predicttime
The actual retard time intervall for prediction retards.


rawtoggle

private Toggling rawtoggle
The Toggling instance for raw-value judgement.


smoothtoggle

private Toggling smoothtoggle
The Toggling instance for smooth-value judgement.


derivativetoggle

private Toggling derivativetoggle
The Toggling instance for derivative-value judgement.


predicttoggle

private Toggling predicttoggle
The Toggling instance for predicted-value judgement.


invert

private boolean invert
True if toggling value is inverse of weather value.


invertderivative

private boolean invertderivative
True if toggling value is inverse for derivative judgement.


weatherlist

private Vector weatherlist
The list of WeatherListeners.

Constructor Detail

WeatherSensor

protected WeatherSensor(Map qualify)
Constructs a fully-qualified weather sensor. The name and the default respawn time and the default pack size are used to either construct a default Map object, or add these keys if not present in the Map object. Use of this constructor guarantees that the Map keys name, respawn, memory, and pack are always set.

Parameters:
qualify - The Map object describing this sensor.
Method Detail

conductOneMeasure

protected void conductOneMeasure()
Adds the judging capabilities to the readout of this sensor. Uses the recently gained measurements to judge the current weather situation. If this one is different to the one deferred by the last call to this method, a weather event is generated and passed to all registered listeners. Note that weather events may be generated in bad weather conditions only because the reason for bad weather has changed (e.g. from bad weather because of a smoothed value fail to a smoothed plus derivative value fail).

WeatherStations combine more than one sensor and should be used for combining weather events from different sources.

Overrides:
conductOneMeasure in class DataSensor

getSensorInitInfo

public String getSensorInitInfo()
Returns a string description of this sensor. The name is returned and any weather judging instance found.

Specified by:
getSensorInitInfo in interface Telemetering
Overrides:
getSensorInitInfo in class AbstractSensor

judgeWeather

protected void judgeWeather()
This method generates the actual judging of the weather situation. In most cases you won't need to override this method.

A weather event is generated, if one of these conditions is met.

Care is taken that weather events are only generated if the conditions changed. No weather event is generated if a bad weather decision is only changed for the reason, but still remains bad.
The advisory property of the predictive, smoothing, and derivative edge of the sensor is taken into account, suppressing weather event generation if weather changes are only reflected by these characterisitcs.


rawChange

private boolean rawChange()
True if a weather event generation should be possible considering the raw sensor. This method is used to check if a e.g. smooth weather change has already been reported by a raw weather change. In the latter case, this method returns false.


smoothChange

private boolean smoothChange()
True if a weather event generation should be possible considering the smooth sensor. This method is used to check if a e.g. raw weather change has already been reported by a smooth weather change. In the latter case, this method returns false.


derivativeChange

private boolean derivativeChange()
True if a weather event generation should be possible considering the derivative sensor. This method is used to check if a e.g. raw weather change has already been reported by a derivative weather change. In the latter case, this method returns false.


predictChange

private boolean predictChange()
True if a weather event generation should be possible considering the predictive sensor. This method is used to check if a e.g. raw weather change has already been reported by a predictive weather change. In the latter case, this method returns false.


notifyWeatherListener

protected void notifyWeatherListener(WeatherEvent we)
Parses through the list of registered weather listeners and passes the argumental weather event to all of them. Synchronizes on the list of weather event listeners.


currentlyClear

public boolean currentlyClear()
Returns true if the weather is currently good. Calls the three methods goodFromRaw(double), goodFromSmooth(double), and goodFromDerivative(double) with the last measurements to derive an overall vote.

Note that this method is intended to be used only at startup.

Specified by:
currentlyClear in interface WeatherJudging

currentlyRetarding

public boolean currentlyRetarding()
Are we in a retarding phase?

Specified by:
currentlyRetarding in interface WeatherJudging

getMinClearUpTime

public long getMinClearUpTime()
If clear, we return zero. Otherwise tha maximum retard time in action.

Specified by:
getMinClearUpTime in interface WeatherJudging

goodFromRaw

protected boolean goodFromRaw(double raw)
A default implementation of the method in WeatherJudging. Subclasses should override this method.


goodFromSmooth

protected boolean goodFromSmooth(double smooth)
A default implementation of the method in WeatherJudging. Subclasses should override this method.


goodFromDerivative

protected boolean goodFromDerivative(double derive)
A default implementation of the method in WeatherJudging. Subclasses should override this method.


goodFromPredict

protected boolean goodFromPredict(double predict)
A default implementation of the method in WeatherJudging. Subclasses should override this method.

Prediciting is more difficult than smoothing or raw-reading. Therefore, this method not only adds the last predicted value to the Toggling instance, but also checks if the prediction is reliable. If not, true is returned.


isRawRetard

public boolean isRawRetard()
Returns true if this weather sensor is raw retarding. A sensor is defined raw retarding if its actual raw-reading indicates a weather change, either from good to bad or vice versa, but it is urged to retain its old 'vote' for a certain time, the retard time. Weather events are only changed after this retardation time has passed. If the vote of the sensor toggles again amidst a retardation phase, no weather events are generated.
This method is essential for packing the data event generated by a weather sensor with additionla information.


isSmoothRetard

public boolean isSmoothRetard()
Returns true if this weather sensor is smooth retarding. A sensor is defined smooth retarding if its actual smoothened-reading indicates a weather change, either from good to bad or vice versa, but it is urged to retain its old 'vote' for a certain time, the retard time. Weather events are only changed after this retardation time has passed. If the vote of the sensor toggles again amidst a retardation phase, no weather events are generated.
This method is essential for packing the data event generated by a weather sensor with additionla information.


isDerivativeRetard

public boolean isDerivativeRetard()
Returns true if this weather sensor is derivative retarding. A sensor is defined derivative retarding if its actual first derivative-reading indicates a weather change, either from good to bad or vice versa, but it is urged to retain its old 'vote' for a certain time, the retard time. Weather events are only changed after this retardation time has passed. If the vote of the sensor toggles again amidst a retardation phase, no weather events are generated.
This method is essential for packing the data event generated by a weather sensor with additionla information.


isPredictRetard

public boolean isPredictRetard()
Returns true if this weather sensor is predict retarding. A sensor is defined predict retarding if its actual prediction indicates a weather change, either from good to bad or vice versa, but it is urged to retain its old 'vote' for a certain time, the retard time. Weather events are only changed after this retardation time has passed. If the vote of the sensor toggles again amidst a retardation phase, no weather events are generated.
This method is essential for packing the data event generated by a weather sensor with additionla information.


generateDataEvent

protected DataEvent generateDataEvent()
Converts the conventional data event into a DataEvent, where the principal measurement reflects the current weather situation. Calls the superclass method and produces a new weather data event out of it, with the additional information whether the measured values are within the allowed thresholds. Note that this routine does use the current weather situation, not the average of the data event, to judge the weather situation.

Overrides:
generateDataEvent in class DerivativeSensor
Returns:
A weather data event with additional status on weather conditions.

addWeatherListener

public void addWeatherListener(WeatherListener ear)
Adds a WeatherListener to the registered listeners. If the argument is null, nothing is changed.

Specified by:
addWeatherListener in interface WeatherCaster
Parameters:
ear - The listener to add.

removeWeatherListener

public void removeWeatherListener(WeatherListener ear)
Removes a WeatherListener from the registered listeners. If the argument is null, nothing is changed.

Specified by:
removeWeatherListener in interface WeatherCaster
Parameters:
ear - The listener to remove.

status

public String status()
Adds the current vote to the status message.

Specified by:
status in interface Telemetering
Overrides:
status in class AbstractSensor