main
Class ModelRunner

java.lang.Object
  extended bymain.ModelRunner
All Implemented Interfaces:
java.lang.Runnable

public class ModelRunner
extends java.lang.Object
implements java.lang.Runnable


Field Summary
 Integrator integrator
           
 boolean running
           
 java.lang.Thread runThread
           
 SimpleStop stopper
           
 
Constructor Summary
ModelRunner(Model model, SimpleStop stopper)
           
 
Method Summary
 void checkForNaN()
          Checks through all nodes of all cells in the model to see whether any of them have out of range numbers (NaN).
 void doReset()
           
 void doRun()
          This has the code which actually runs a model.
 void doStartRun()
          Call doStartRun() to initialize a model for running it.
 void doStep()
           
 Cell[] getCells()
           
 Model getModel()
           
 int getNumCells()
           
 int getNumNodes()
           
 SimpleStop getStopper()
           
 boolean isRunning()
          Returns true if the model is currently running
 void run()
          No other class should call run() directly.
 void setRunMode(java.lang.String rm)
           
 void setStopper(SimpleStop stopper)
           
 void startRun()
          These next functions wrap the running of a model inside a thread.
 void stopRun()
          Call stopRun() to stop a model that's currently running.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

runThread

public java.lang.Thread runThread

integrator

public Integrator integrator

stopper

public SimpleStop stopper

running

public boolean running
Constructor Detail

ModelRunner

public ModelRunner(Model model,
                   SimpleStop stopper)
Method Detail

setStopper

public void setStopper(SimpleStop stopper)

getStopper

public SimpleStop getStopper()

startRun

public void startRun()
These next functions wrap the running of a model inside a thread. You can either use these threaded functions, or you can directly run a model by calling doStartRun() and doRun().
Call startRun() to start running a model in a new thread. startRun() calls run(). The parent function should then wait until running gets set to false, at which point the model is done running.


run

public void run()
No other class should call run() directly. Instead, call startRun().

Specified by:
run in interface java.lang.Runnable

stopRun

public void stopRun()
Call stopRun() to stop a model that's currently running. It should work for both threaded and non-threaded models, I think.


isRunning

public boolean isRunning()
Returns true if the model is currently running


doStartRun

public void doStartRun()
Call doStartRun() to initialize a model for running it. If you want to run the model inside a thread, call startRun() instead.


doReset

public void doReset()

doRun

public void doRun()
           throws java.lang.Exception
This has the code which actually runs a model. You need to call doStartRun() first before calling doRun(). If you want to run the model inside a thread, call startRun() instead, and the run() method will call this function.

Throws:
java.lang.Exception

doStep

public void doStep()
            throws java.lang.Exception
Throws:
java.lang.Exception

checkForNaN

public void checkForNaN()
                 throws java.lang.Exception
Checks through all nodes of all cells in the model to see whether any of them have out of range numbers (NaN). Currently called every time the screen display is updated while running a model, and at the end of each uberiterator run.

Throws:
java.lang.Exception

setRunMode

public void setRunMode(java.lang.String rm)

getModel

public Model getModel()

getCells

public Cell[] getCells()

getNumCells

public int getNumCells()

getNumNodes

public int getNumNodes()