|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--SimulationEngine
The SimulationEngine coordinates reading Commands via the CommandParser and feeding those Commands to the Robot model.
Field Summary | |
protected boolean |
requestStop
A flag indicating a request to stop the simulation. |
protected java.lang.Thread |
simulationThread
The Thread controlling the simulation. |
protected CommandParser |
theCommandParser
The CommandParser used to read Commands. |
protected CommandQueue |
theCommandQueue
The CommandQueue of Commands to be processed. |
Constructor Summary | |
SimulationEngine()
Constructor, initialize the variables. |
Method Summary | |
boolean |
isComplete()
Indicates if the simulation has finished. |
boolean |
isReady()
Returns if the CommandQueue has been loaded and is not empty. |
void |
loadCommandQueue(java.io.Reader r)
Parse the given Reader stream for Commands using the current CommandParser, and load the CommandQueue object for the simulation. |
void |
run()
The loop for the SimulationEngine Thread, which steps the simulation to the next state while the CommandQueue has more Commands to process. |
void |
setCommandParser(CommandParser theCommandParser)
Sets the current CommandParser object. |
void |
start()
Starts the SimulationEngine's Thread with NORMAL_PRIORITY. |
void |
step()
Gets the next Command object from the CommandQueue, and feeds the Command to the Robot to get the destination Robot state. |
void |
stop()
Stops the simulation. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected CommandParser theCommandParser
protected CommandQueue theCommandQueue
protected boolean requestStop
protected java.lang.Thread simulationThread
Constructor Detail |
public SimulationEngine()
Method Detail |
public void setCommandParser(CommandParser theCommandParser)
theCommandParser
- the new CommandParser object.public void loadCommandQueue(java.io.Reader r) throws SimulationEngineException
r
- the Reader stream to parse for simulation commands.public void step() throws java.lang.Exception
public void start()
public void run()
public void stop()
public boolean isComplete()
public boolean isReady()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |