main
Class Model

java.lang.Object
  extended bymain.Model
All Implemented Interfaces:
ModelStateChangeListener

public class Model
extends java.lang.Object
implements ModelStateChangeListener


Field Summary
 int arrayHeight
           
 int arrayWidth
           
 Cell[] cells
           
static int END_OF_RUN
           
 Network net
           
static int NEW_RUN
           
 int numCells
           
 java.io.PrintWriter out
           
static int UPDATE_CELLS
           
 
Constructor Summary
Model()
          Note - after making a new Model, you should immediately call the load() function.
 
Method Summary
 void cleanUp()
           
 float getInitialValue(int node)
          Returns the default initial value for this node as given by its initializers object.
 ParameterSet getModelParameterSet()
           
 ModelState getModelState()
          Returns the ModelState Object associated with this model
 java.lang.String getName()
           
 Network getNetwork()
           
 boolean isGood()
           
 void load(BetterTokenizer tokenizer)
           
 void saveNetworkFile(java.io.PrintWriter pw)
           
 void setInitialValue(int node, float value)
          Calls setDefaultInitialValue with given parameters in its initializers object.
 void setModelState(ModelState state)
          Sets a ModelState object for this Model.
 void setParameterSet(ParameterSet parameters)
           
 void setupOutput()
           
 void updateAll()
          Indicates that the entire ModelState has been updated
 void updateNode(int cellIndex, int nodeIndex, float value)
          Updates only the indicated node.
 void updateOutput(int type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

END_OF_RUN

public static final int END_OF_RUN
See Also:
Constant Field Values

NEW_RUN

public static final int NEW_RUN
See Also:
Constant Field Values

UPDATE_CELLS

public static final int UPDATE_CELLS
See Also:
Constant Field Values

arrayWidth

public int arrayWidth

arrayHeight

public int arrayHeight

numCells

public int numCells

cells

public Cell[] cells

net

public Network net

out

public java.io.PrintWriter out
Constructor Detail

Model

public Model()
Note - after making a new Model, you should immediately call the load() function. Operations using the Model are undefined before load is called and will probably crash. You can check isGood() to see if a model is in a usable state.

Method Detail

load

public void load(BetterTokenizer tokenizer)
          throws ModelLoadingException,
                 java.lang.Exception
Throws:
ModelLoadingException
java.lang.Exception

getNetwork

public Network getNetwork()

getName

public java.lang.String getName()

getModelParameterSet

public ParameterSet getModelParameterSet()

setParameterSet

public void setParameterSet(ParameterSet parameters)

setupOutput

public void setupOutput()

cleanUp

public void cleanUp()

getModelState

public ModelState getModelState()
Returns the ModelState Object associated with this model

Returns:
ModelState - The current ModelState. May be null.

getInitialValue

public float getInitialValue(int node)
Returns the default initial value for this node as given by its initializers object. If there is no default initializer for this node, returns -1.


setInitialValue

public void setInitialValue(int node,
                            float value)
Calls setDefaultInitialValue with given parameters in its initializers object.


saveNetworkFile

public void saveNetworkFile(java.io.PrintWriter pw)

isGood

public boolean isGood()

setModelState

public void setModelState(ModelState state)
Sets a ModelState object for this Model. If a ModelState object is set, then its values will be updated at the end of each integration step causing anything that is listening to it via the ModelStateChangeListener interface to be updated


updateOutput

public void updateOutput(int type)

updateAll

public void updateAll()
Indicates that the entire ModelState has been updated

Specified by:
updateAll in interface ModelStateChangeListener

updateNode

public void updateNode(int cellIndex,
                       int nodeIndex,
                       float value)
Updates only the indicated node.

Specified by:
updateNode in interface ModelStateChangeListener