stella.sensor
Interface Predicting

All Superinterfaces:
Cumulating
All Known Implementing Classes:
AverageSensor, BadSensor, DerivativeSensor, DewPoint, FakeSensor, FakeSolZSensor, HealthSensor, KeystrokeSensor, MoxaSensor, NoiseSolZSensor, OneWireADSensor, OneWireRainSensor, OneWireSensor, ParameterSensor, PredictiveSensor, QuickDumpSensor, RS485Sensor, SmoothingSensor, SolHeightSensor, SolZSensor, Ups, UpsSensor, WeatherSensor, WeirdSolZSensor

public interface Predicting
extends Cumulating

The interface marking predictive capabilities of a sensor. It is an extension to the cumulative interface because predicting datas will always require storing some past data. As a consequence, no methods for access to the time axis are given here. They are inherited from the base interface.

This interface is introduced to make it more convenient to derive one's own combination of smoothing and/or deriving sensors. A default implementation PredictiveSensor implements this interface and gives a body for these methods.


Method Summary
 List getLastPredict(int nr)
          Returns the last bulk of predicted values as a list.
 boolean isPredicting()
          Returns true if the implementing instance is really predicting data and should be treated seperately.
 boolean isReliable()
          Returns true if the prediction can be trusted.
 void predictFrom(double raw)
          Predicts from the raw value and adds it to an internal buffer.
 double regetPredict()
          Returns the last predicted value as a double.
 
Methods inherited from interface stella.sensor.Cumulating
cumulateOne, getLastRaw, getLastTime, getMaxSize, getSize, getTimeOfRead, regetRaw
 

Method Detail

predictFrom

void predictFrom(double raw)
Predicts from the raw value and adds it to an internal buffer.


regetPredict

double regetPredict()
Returns the last predicted value as a double.


getLastPredict

List getLastPredict(int nr)
Returns the last bulk of predicted values as a list. The sublist consists of the given number of elements up to the last one in the list. The first element in the list is therefore buffer.size-nr.

Parameters:
nr - The number of predicted values to be retrieved.

isPredicting

boolean isPredicting()
Returns true if the implementing instance is really predicting data and should be treated seperately.


isReliable

boolean isReliable()
Returns true if the prediction can be trusted. Predicting sensor datas is of course difficult, so this method should give you a handle in determining if the predicted result is trustworthy. Note that this should not block the prediction from feeding a Toggling instance, but should rather be used to judge the result returned from the toggling instance.