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.


Variable Index

 o FAST
 o NORMAL
 o PAUSED

Constructor Index

 o SimThread(PBrick)
Create a simulation thread for the specified PBrick.

Method Index

 o getSpeed()
Get the current speed of the simulation thread.
 o run()
 o setSpeed(int)
Change the speed of the simulation thread.

Variables

 o PAUSED
 public static final int PAUSED
 o NORMAL
 public static final int NORMAL
 o FAST
 public static final int FAST

Constructors

 o 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

Methods

 o setSpeed
 public void setSpeed(int speed)
Change the speed of the simulation thread.

Parameters:
speed - new speed (PAUSED, NORMAL, or FAST)
 o getSpeed
 public int getSpeed()
Get the current speed of the simulation thread.

Returns:
s current speed (PAUSED, NORMAL, or FAST)
 o run
 public synchronized void run()
Overrides:
run in class java.lang.Thread

All Packages  Class Hierarchy  This Package  Previous  Next  Index