fi.hut.tml.xsmiles.timesheet.timer
Class Timer

java.lang.Object
  extended byfi.hut.tml.xsmiles.timesheet.timer.Timer
All Implemented Interfaces:
java.lang.Runnable

public class Timer
extends java.lang.Object
implements java.lang.Runnable

Class Timer is the scheduler for TimedElement instances. Timer listens for ticks that are produced by static singleton instance of the inner class Clock. By every tick the Timer calls the update(long)-method of the registered TimedElement instances.

Since:
Mar 2, 2004
Version:
$Revision: 5510 $, $Date: 2004-09-16 14:56:17 +0300 (Thu, 16 Sep 2004) $
Author:
tjjalava

Nested Class Summary
protected  class Timer.Clock
          Class Clock produces one clock tick every INTERVAL milliseconds
 
Field Summary
protected  Timer.Clock clock
           
protected static int INTERVAL
          The interval for ticks
 
Constructor Summary
Timer(TimedElement root)
          Creates the Timer instance
 
Method Summary
 void pause(boolean paused)
           
 void run()
           
 void setClocker(Clocker clocker)
           
 void start()
          Starts the Timer
 void stop()
          Stops Timer
static long ticksToTime(long ticks)
           
static long timeToTicks(long millis)
          Converts milliseconds, used in the attributes of Timesheets into ticks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTERVAL

protected static final int INTERVAL
The interval for ticks

See Also:
Constant Field Values

clock

protected final Timer.Clock clock
Constructor Detail

Timer

public Timer(TimedElement root)
Creates the Timer instance

Method Detail

setClocker

public void setClocker(Clocker clocker)

timeToTicks

public static long timeToTicks(long millis)
Converts milliseconds, used in the attributes of Timesheets into ticks

Parameters:
millis - the time used in timesheets
Returns:
ticks corresponding to the millis

ticksToTime

public static long ticksToTime(long ticks)

start

public void start()
Starts the Timer


pause

public void pause(boolean paused)

stop

public void stop()
Stops Timer


run

public void run()
Specified by:
run in interface java.lang.Runnable


X-Smiles 1.2