thegame.client
Class GameClient.GameScreen.Monitor

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--thegame.client.GameClient.GameScreen.Monitor
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
GameClient.GameScreen

protected class GameClient.GameScreen.Monitor
extends java.lang.Thread

Is used for counting the elapsed turn time of the active player; also for checking whether the local player has made a move.

Version:
0.99 (2000/08/28)
Author:
Erki Suurjaak

Field Summary
protected  java.text.SimpleDateFormat formatter
          Is used to convert a time in milliseconds into a HH:MM:SS format.
protected  boolean isFirstChange
          Is true if the player whose time the Monitor is counting has been changed and the Monitor is not aware of it yet; is false otherwise.
protected  boolean isRunning
          Is true if the Monitor is running; is false otherwise.
protected  boolean isSetRunning
          Is true if the Monitor has been set running but the main cycle of the run() method has not been entered yet; is false otherwise.
protected  boolean isStarted
          Is true if the Monitor has already been started; is false otherwise.
protected  boolean isTickingLocalPlayer
          Is true if the Monitor is counting the time of the local player; is false if the Monitor is counting the time of the remote player.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GameClient.GameScreen.Monitor()
          Constructs a Monitor.
 
Method Summary
 void run()
          Counts the time of the player whose turn it is.
 void setRunning(boolean running)
          Either starts or stops the Monitor thread.
 void setTickingLocalPlayer(boolean isTickingLocalPlayer)
          Is used to change the player whose time is being counted.
 
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
 

Field Detail

formatter

protected java.text.SimpleDateFormat formatter
Is used to convert a time in milliseconds into a HH:MM:SS format.

isFirstChange

protected boolean isFirstChange
Is true if the player whose time the Monitor is counting has been changed and the Monitor is not aware of it yet; is false otherwise.

isRunning

protected boolean isRunning
Is true if the Monitor is running; is false otherwise.

isSetRunning

protected boolean isSetRunning
Is true if the Monitor has been set running but the main cycle of the run() method has not been entered yet; is false otherwise.

isStarted

protected boolean isStarted
Is true if the Monitor has already been started; is false otherwise.

isTickingLocalPlayer

protected boolean isTickingLocalPlayer
Is true if the Monitor is counting the time of the local player; is false if the Monitor is counting the time of the remote player.
Constructor Detail

GameClient.GameScreen.Monitor

public GameClient.GameScreen.Monitor()
Constructs a Monitor.
Method Detail

run

public void run()
Counts the time of the player whose turn it is. Also checks whether the local player has made a move and acts accordingly.
Overrides:
run in class java.lang.Thread

setRunning

public void setRunning(boolean running)
Either starts or stops the Monitor thread.
Parameters:
running - true if the thread will be set running, false if the thread will be stopped.

setTickingLocalPlayer

public void setTickingLocalPlayer(boolean isTickingLocalPlayer)
Is used to change the player whose time is being counted.
Parameters:
isTickingLocalPlayer - true if the Monitor will start counting the time of the local player; false if the Monitor will start counting the time of the remote player