org.jscience.architecture.traffic.simulation
Class SimModel.SimModelThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.jscience.architecture.traffic.simulation.SimModel.SimModelThread
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
SimModel

public class SimModel.SimModelThread
extends java.lang.Thread

The second thread that runs the simulation.


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
SimModel.SimModelThread()
          Starts the thread.
 
Method Summary
 void die()
          Stops the thread.
 int getSleepTime()
          Returns the current sleep time
 boolean isRunning()
          Returns true if the thread is not suspended and not dead
 void pause()
          Suspends the thread.
 void run()
          Invokes Model.doStep() and sleeps for sleepTime milliseconds
 void setSleepTime(int s)
          Sets the sleep time
 void unpause()
          Resumes the thread.
 
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
 

Constructor Detail

SimModel.SimModelThread

public SimModel.SimModelThread()
Starts the thread.

Method Detail

getSleepTime

public int getSleepTime()
Returns the current sleep time

Returns:
DOCUMENT ME!

setSleepTime

public void setSleepTime(int s)
Sets the sleep time

Parameters:
s - DOCUMENT ME!

pause

public void pause()
Suspends the thread.


unpause

public void unpause()
Resumes the thread.


die

public void die()
Stops the thread. Invoked when the program exitst. This method cannot be named stop().


isRunning

public boolean isRunning()
Returns true if the thread is not suspended and not dead

Returns:
DOCUMENT ME!

run

public void run()
Invokes Model.doStep() and sleeps for sleepTime milliseconds

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