Class GameTimer

java.lang.Object
  extended by java.lang.Thread
      extended by GameTimer
All Implemented Interfaces:
java.lang.Runnable

public class GameTimer
extends java.lang.Thread

Class used for the implementation of a timer. The Timer uses threading so it will not be interrupted. Very simlple functionality to start/stop time and get elapsed time variables.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GameTimer(GameClient newClient)
          Constructor: initialize calendar variable
 
Method Summary
 void endTimer()
          Method for stopping the timer.
 void run()
          Runs the timer in its own thread
 void startTimer()
          Method for starting the timer
 java.lang.String toString()
          Returns a string of the current running game time.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GameTimer

public GameTimer(GameClient newClient)
Constructor: initialize calendar variable

Method Detail

run

public void run()
Runs the timer in its own thread

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

startTimer

public void startTimer()
Method for starting the timer


endTimer

public void endTimer()
Method for stopping the timer. Sets variable keepTime to false which will exit the currently running thread.


toString

public java.lang.String toString()
Returns a string of the current running game time.

Overrides:
toString in class java.lang.Thread