org.globalse.arena.frag.util
Class Timer

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--org.globalse.arena.frag.util.Timer

public class Timer
extends java.lang.Thread
implements EventSource

The Timer class sends a TimerEvent, a subclass of ObjectActionEvent, in fixed time steps to a certain object. $Id: Timer.html,v 1.1 2003/02/12 18:06:20 schoecke Exp $


Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Timer()
           
 
Method Summary
 void disable()
          Disables (stops) the timer.
 void enable(int interval)
          Starts the timer.
 EventDistributor eventDistributor()
          Returns the EventDistributor instance.
 java.lang.String getGameName()
          Returns the name of the game.
 int getInterval()
          Returns the interval between the time steps.
 java.lang.String getObjectName()
          Returns the name of the current object.
 java.lang.String getTimerName()
          Returns the name of the timer.
 void run()
          The run method for the thread, which startes the timer.
 void setGameName(java.lang.String gameName)
          Sets the name of the game to the given parameter, if the timer is started.
 void setObjectName(java.lang.String objectName)
          Sets the name of the current object to the given parameter, if the timer is started
 void setTimerName(java.lang.String timerName)
          Sets the name of the timer to the given parameter, if the timer is started.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, 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

Timer

public Timer()
Method Detail

getInterval

public int getInterval()
Returns the interval between the time steps.
Returns:
the interval between the steps.

getGameName

public java.lang.String getGameName()
Returns the name of the game.
Returns:
the name of the game

setGameName

public void setGameName(java.lang.String gameName)
Sets the name of the game to the given parameter, if the timer is started.
Parameters:
gameName - the new name of the game

getObjectName

public java.lang.String getObjectName()
Returns the name of the current object.
Returns:
the name of the current object

setObjectName

public void setObjectName(java.lang.String objectName)
Sets the name of the current object to the given parameter, if the timer is started
Parameters:
objectName - String sets the object name

getTimerName

public java.lang.String getTimerName()
Returns the name of the timer.
Returns:
the name of the timer

setTimerName

public void setTimerName(java.lang.String timerName)
Sets the name of the timer to the given parameter, if the timer is started.
Parameters:
timerName - the new name of the timer

enable

public void enable(int interval)
Starts the timer.
Parameters:
interval - int value for the timer

disable

public void disable()
Disables (stops) the timer.

run

public void run()
The run method for the thread, which startes the timer. Sends a TimerEvent after each step.
Overrides:
run in class java.lang.Thread

eventDistributor

public EventDistributor eventDistributor()
Returns the EventDistributor instance.
Specified by:
eventDistributor in interface EventSource
Returns:
the event distributor



This page is hosted by the Chair for Applied Software Engineering of the Technische Universität München.
Imprint (Impressum)