com.planeth.common.timing
Class TimerManager

java.lang.Object
  extended bycom.planeth.common.timing.TimerManager

public class TimerManager
extends java.lang.Object

TimerManager handles and stores timers. That makes it possible to interact with all used timers together without knowing their purpose.
For example pausing the whole application.

Author:
Andreas Grässer, gal@planet-h.com
created 25.12.2005
See Also:
Timer, WaitTimer

Method Summary
static TimerManager getInstance(java.lang.Object obj)
          Returns a TimerManager instance for the passed Object
 Timer getTimer(java.lang.String name)
          Returns the Timer with the passed name
 WaitTimer getWaitTimer(java.lang.String name)
          Returns the WaitTimer with the passed name
static void pauseAllTimersGlobal(boolean pauseState)
          Pauses all Timers of all TimerManager instances
 void putTimer(java.lang.String name, Timer timer)
          Puts a Timer to the TimerManager
 void putWaitTimer(java.lang.String name, WaitTimer waitTimer)
          Puts a WaitTimer to the TimerManager
 void removeAllTimers()
          Removes all Timers of the current TimerManager instance
static void removeInstance(java.lang.Object obj)
          Removes the TimerManager instance for the passed Object, if it's existing
 void removeTimer(java.lang.String name)
          Removes and terminates the Timer with the passed name
 void removeWaitTimer(java.lang.String name)
          Removes and terminates the WaitTimer with the passed name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TimerManager getInstance(java.lang.Object obj)
Returns a TimerManager instance for the passed Object

Parameters:
obj - object, on which the created TimerManager is bound
Returns:
TimerManager instance

removeInstance

public static void removeInstance(java.lang.Object obj)
Removes the TimerManager instance for the passed Object, if it's existing

Parameters:
obj - object, on which the created TimerManager is bound

pauseAllTimersGlobal

public static void pauseAllTimersGlobal(boolean pauseState)
Pauses all Timers of all TimerManager instances

Parameters:
pauseState - true = pause, false = unpause

putTimer

public void putTimer(java.lang.String name,
                     Timer timer)
Puts a Timer to the TimerManager

Parameters:
name - the name of the timer
timer - the Timer object to be stored

getTimer

public Timer getTimer(java.lang.String name)
Returns the Timer with the passed name

Parameters:
name - the name of the timer
Returns:
Timer a timer

removeTimer

public void removeTimer(java.lang.String name)
Removes and terminates the Timer with the passed name

Parameters:
name - the name of the timer

putWaitTimer

public void putWaitTimer(java.lang.String name,
                         WaitTimer waitTimer)
Puts a WaitTimer to the TimerManager

Parameters:
name - the name of the timer
waitTimer - the WaitTimer object to be stored

getWaitTimer

public WaitTimer getWaitTimer(java.lang.String name)
Returns the WaitTimer with the passed name

Parameters:
name - the name of the timer
Returns:
WaitTimer a waitTimer

removeWaitTimer

public void removeWaitTimer(java.lang.String name)
Removes and terminates the WaitTimer with the passed name

Parameters:
name - the name of the timer

removeAllTimers

public void removeAllTimers()
Removes all Timers of the current TimerManager instance