Class PlaybackThread

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

public class PlaybackThread
extends java.lang.Thread

This is a thread class that keeps executing moves in the playback moves list until no further moves remain.

See Also:
Playback

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
(package private)  long defaultSleepTime
          Default length of time (in ms) to sleep between each move
(package private)  long sleepTime
          Length of time (in ms) to sleep between each move
(package private)  boolean stop
          Stops the thread if set to true
(package private)  Playback thePlayback
          The Playback object to execute moves from
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PlaybackThread(Playback pb)
          Constructor sets the playback object and sets the sleeptime to its default value.
PlaybackThread(Playback pb, long speed)
          Constructor sets the playback object and sets the sleeptime to the passed in value.
 
Method Summary
 void changeSpeed(long newSpeed)
          Changes the sleeptime to the passed in value.
 void run()
          This function fires whenever the thread is started and continually moves through moves in playback's move list until no further moves remain or the thread is stopped.
 
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, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

stop

boolean stop
Stops the thread if set to true


sleepTime

long sleepTime
Length of time (in ms) to sleep between each move


defaultSleepTime

final long defaultSleepTime
Default length of time (in ms) to sleep between each move

See Also:
Constant Field Values

thePlayback

Playback thePlayback
The Playback object to execute moves from

Constructor Detail

PlaybackThread

public PlaybackThread(Playback pb)
Constructor sets the playback object and sets the sleeptime to its default value.

Parameters:
pb - The Playback object to execute moves from

PlaybackThread

public PlaybackThread(Playback pb,
                      long speed)
Constructor sets the playback object and sets the sleeptime to the passed in value.

Parameters:
pb - The playback object to execute moves from
speed - The sleep time between moves (in ms)
Method Detail

run

public void run()
This function fires whenever the thread is started and continually moves through moves in playback's move list until no further moves remain or the thread is stopped. There is a deley between moves specified in milliseconds by the sleepTime var.

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

changeSpeed

public void changeSpeed(long newSpeed)
Changes the sleeptime to the passed in value.

Parameters:
newSpeed - New sleeptime between moves (in ms)