stella.sensor
Class SensorRepository.Averager

java.lang.Object
  extended by java.util.TimerTask
      extended by stella.sensor.SensorRepository.Averager
All Implemented Interfaces:
Runnable
Enclosing class:
SensorRepository

protected class SensorRepository.Averager
extends TimerTask

This class collects all data events generated during the averaging interval. It generates an averaged data event out of it and stores a mapping of sensor names to averaged data events. Additionally, it notifies listeners if their time interval has been reached.


Field Summary
private  int round
          Counting the number of runs of the averager.
 
Constructor Summary
protected SensorRepository.Averager()
          Constructs a new averager task.
 
Method Summary
 void run()
          This method reads out all collected data from all sensors monitored by the enclosing repository.
private  void sendData(Object receiver, int average)
          Notifies a data collecting instance using the last averaged data events.
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

round

private int round
Counting the number of runs of the averager.

Constructor Detail

SensorRepository.Averager

protected SensorRepository.Averager()
Constructs a new averager task. it should never be started prior to data arrival.

Method Detail

run

public void run()
This method reads out all collected data from all sensors monitored by the enclosing repository. For each sensor name found, the list of the data events collected is retrieved from the SensorRepository.average map. The data events are averaged and the list stored in the SensorRepository.average map is cleared.
It then calls the data collector defined in the repository. Note that this averager will only execute if this collector is a valid object, as guaranteed by the repository.

Specified by:
run in interface Runnable
Specified by:
run in class TimerTask

sendData

private void sendData(Object receiver,
                      int average)
               throws RemoteException
Notifies a data collecting instance using the last averaged data events.

Throws:
RemoteException