time
Class TimeManager

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--time.TimeManager
All Implemented Interfaces:
java.awt.event.AdjustmentListener, java.util.EventListener, java.lang.Runnable

public class TimeManager
extends java.lang.Thread
implements java.awt.event.AdjustmentListener

Class providing functions to manage this timing thread.


Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TimeManager(int d)
          Creates a new TimeManager instance.
 
Method Summary
 void addTimed(Timed el)
          Method to add an object to the timer
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
          A method to change the timers delay.
 void changeDelay(int d)
          A method to change the timers delay.
 boolean isPaused()
           
 void removeTimed(Timed el)
          Describe removeTimed method here.
 void run()
          The run() method for the timer thread.
 void setPaused(boolean p)
          Stops the timer from generating events.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeManager

public TimeManager(int d)
Creates a new TimeManager instance.

Parameters:
d - a int that specifies the delay in millisecond between each clock tick of this timer.
Method Detail

addTimed

public void addTimed(Timed el)
Method to add an object to the timer

Parameters:
el - a object implementing the Timed interface.

removeTimed

public void removeTimed(Timed el)
Describe removeTimed method here.

Parameters:
el - a Timed value

isPaused

public boolean isPaused()

adjustmentValueChanged

public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
A method to change the timers delay. Used by a slider bar for example.

Specified by:
adjustmentValueChanged in interface java.awt.event.AdjustmentListener
Parameters:
e - an AdjustmentEvent

setPaused

public void setPaused(boolean p)
Stops the timer from generating events.

Parameters:
p - a boolean value

changeDelay

public void changeDelay(int d)
A method to change the timers delay.

Parameters:
d - a int that specifies the delay in millisecond between each clock tick of this timer.

run

public void run()
The run() method for the timer thread. Every d milliseconds, the timer calls pretick() and then tick() on all the objects it has been given.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread