org.elkoserver.foundation.timer
Class Clock

java.lang.Object
  extended by org.elkoserver.foundation.timer.Clock

public class Clock
extends Object

Object which calls the TickNoticer.noticeTick(int) method on a target object every n milliseconds. Clocks can only be created by calling the every() method on a Timer instance.

A Clock can be started and stopped.

See Also:
TickNoticer

Method Summary
 int getTicks()
          Gets the current tick number.
 void start()
          Starts this clock from the current tick.
 void stop()
          Stops this clock from ticking.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTicks

public int getTicks()
Gets the current tick number. This is the number of times this clock has ticked (i.e., invoked its TickNoticer) since it was created.

Returns:
the current tick count.

start

public void start()
Starts this clock from the current tick.


stop

public void stop()
Stops this clock from ticking. It can be restarted with start().