stella.sensor
Class TimerTaskSensor.SensorRead

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

protected class TimerTaskSensor.SensorRead
extends TimerTask

The timer task helper class to allow this sensor to be scheduled via a Timer object. If multiple inheritance would be allowed, the timer task sensor could directly subclass a timer task.


Field Summary
private  boolean running
          Lets a thread check, if another one is currently underway.
 
Constructor Summary
protected TimerTaskSensor.SensorRead()
          Constructs a new sensor read as a timer task.
 
Method Summary
 void run()
          Reads this sensor at a specified frequency.
 
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

running

private boolean running
Lets a thread check, if another one is currently underway.

Constructor Detail

TimerTaskSensor.SensorRead

protected TimerTaskSensor.SensorRead()
Constructs a new sensor read as a timer task.

Method Detail

run

public void run()
Reads this sensor at a specified frequency. The thread can be stopped by calling its cancel() superclass-method.
This method calls the protected abstract method readSensor() of the embedding class, that actually converts the signal of the sensor to a double. Note that at times of high cpu-load of the system, the execution of the reading process may occur at non-equally spaced time intervalls.

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