org.erights.e.extern.timer
Class Clock

java.lang.Object
  |
  +--org.erights.e.extern.timer.TimerWatcher
        |
        +--org.erights.e.extern.timer.Clock

public class Clock
extends TimerWatcher

Untamed:


Field Summary
private  boolean amTicking
          Current run state
private  Object myLock
           
private  long myResolution
          Tick resolution in milliseconds
private  TickReactor myTarget
          Target EObject
private  TimerThread myThread
          The timer thread that is our source of tick events
private  int myTicks
          Current tick number
private  Vat myVat
           
 
Constructor Summary
(package private) Clock(TimerThread thread, long resolution, TickReactor target)
          Called by the Timer.every() method.
 
Method Summary
 int getTicks()
          Enabled: Gets the current tick
(package private)  void handleTimeout()
          Called by the timer thread at clock tick time.
 void start()
          Enabled: Starts the Clock from the current tick.
 void stop()
          Enabled: Stops the clock from ticking.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myLock

private final Object myLock

myThread

private final TimerThread myThread
The timer thread that is our source of tick events


myVat

private final Vat myVat

myTarget

private final TickReactor myTarget
Target EObject


amTicking

private boolean amTicking
Current run state


myResolution

private final long myResolution
Tick resolution in milliseconds


myTicks

private int myTicks
Current tick number

Constructor Detail

Clock

Clock(TimerThread thread,
      long resolution,
      TickReactor target)
Called by the Timer.every() method.

Captures the current Vat, so must be called from within the vat-thread holding target.

Parameters:
thread - The timer thread we are running with
resolution - How often we are to get tick events
Method Detail

getTicks

public int getTicks()
Enabled: Gets the current tick

Returns:
The current tick setting.

handleTimeout

void handleTimeout()
Called by the timer thread at clock tick time.

Specified by:
handleTimeout in class TimerWatcher

start

public void start()
Enabled: Starts the Clock from the current tick.


stop

public void stop()
Enabled: Stops the clock from ticking. The clock can be restarted with start().



comments?