All Packages Class Hierarchy This Package Previous Next Index
Class pbsim.SimThread
java.lang.Object
|
+----java.lang.Thread
|
+----pbsim.SimThread
- public class SimThread
- extends java.lang.Thread
This class provides an easy way to run the simulation on its own thread.
The thread can be have one of three speeds:
PAUSED - simulation is halted
NORMAL - simulation will attempt to run in real time
FAST - simulation will run as fast as it can. This can be hundreds of
times faster than an actual RCX.
-
FAST
-
-
NORMAL
-
-
PAUSED
-
-
SimThread(PBrick)
- Create a simulation thread for the specified PBrick.
-
getSpeed()
- Get the current speed of the simulation thread.
-
run()
-
-
setSpeed(int)
- Change the speed of the simulation thread.
PAUSED
public static final int PAUSED
NORMAL
public static final int NORMAL
FAST
public static final int FAST
SimThread
public SimThread(pbsim.PBrick pb)
- Create a simulation thread for the specified PBrick. Like all threads,
this thread must be started by calling start().
- Parameters:
- pb - the PBrick to be simulated
setSpeed
public void setSpeed(int speed)
- Change the speed of the simulation thread.
- Parameters:
- speed - new speed (PAUSED, NORMAL, or FAST)
getSpeed
public int getSpeed()
- Get the current speed of the simulation thread.
- Returns:
- s current speed (PAUSED, NORMAL, or FAST)
run
public synchronized void run()
- Overrides:
- run in class java.lang.Thread
All Packages Class Hierarchy This Package Previous Next Index