|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.engine.SimModelImpl
public abstract class SimModelImpl
A partial implementation of the SimModel interface. Most, if not all, actual models will inherit from this class. By default SimModelImpl initializes the random number generator in the Random class using the current timestamp as a seed. Random can then be used for random number generator. If you need to have two random number streams with different seeds, you'll need to make your own. See the random number how to in repast/docs/how_to/random.html for more information. When data is collected from a model, it is this seed for this rng that is written out.
Random| Field Summary | |
|---|---|
protected java.util.Hashtable |
descriptors
Used to store property descriptors. |
protected ModelManipulator |
modelManipulator
A ModelManipulator that can be used to manipulate the model at run time. |
| Constructor Summary | |
|---|---|
SimModelImpl()
Constructs a SimModel and initializes the default random number generator in uchicago.src.sim.util.Random with the current timestamp (new java.util.Date()) as the seed. |
|
| Method Summary | |
|---|---|
protected void |
addPropertyListener(PropertyListener listener)
Adds a PropertyListener to this model. |
void |
addSimEventListener(SimEventListener l)
Adds a SimEventListener to listen for SimEvents broadcast from this model. |
void |
clearMediaProducers()
Clears the vector of media producers. |
void |
clearPropertyListeners()
Clears the list of PropertyListeners. |
void |
fireBooleanPropertyEvent(PropertyEvent evt)
Broadcasts a boolean property event to all this model's PropertyEventListeners. |
protected void |
fireEndSim()
Broadcasts a SimEvent with an id of SimEvent.END_EVENT to all this model's listeners. |
void |
fireNumericPropertyEvent(PropertyEvent evt)
Broadcasts a numeric property event to all this model's PropertyEventListeners. |
void |
fireObjectPropertyEvent(PropertyEvent evt)
Broadcasts an object property event to all this model's PropertyEventListeners. |
protected void |
firePauseSim()
Broadcasts a SimEvent with an id of SimEvent.PAUSE_EVENT to all this model's listeners. |
void |
fireSimEvent(SimEvent evt)
Broadcast the specified SimEvent to all this model's SimEventListeners |
protected void |
fireStopSim()
Broadcasts a SimEvent with an id of SimEvent.STOP_EVENT to all this model's listeners. |
void |
fireStringPropertyEvent(PropertyEvent evt)
Broadcasts a string property event to all this model's PropertyEventListeners. |
void |
generateNewSeed()
Generates a new seed for the random number generator using the current timestamp. |
IController |
getController()
Gets the BaseController associated with this model. |
java.util.Vector |
getMediaProducers()
Gets the mediaProducers registered with this model. |
ModelManipulator |
getModelManipulator()
Gets the ModelManipulator. |
java.util.Hashtable |
getParameterDescriptors()
Gets a hashtable of ParameterDescriptors where key is parameter name, and value is the ParameterDescriptor. |
java.lang.String |
getPropertiesValues()
Gets a String listing the model parameters and values. |
long |
getRngSeed()
Gets the current random seed. |
double |
getTickCount()
Gets the current tick count |
void |
pause()
Pause the simulation. |
void |
registerDisplaySurface(java.lang.String name,
DisplaySurface surface)
Registers a DisplaySurface with this model and associates it with a particular name. |
void |
registerMediaProducer(java.lang.String name,
MediaProducer media)
Registers a MediaProducer with this model and associates it with the specified name. |
protected void |
removePropertyListener(PropertyListener listener)
Removes a PropertyListener from this model. |
void |
removeSimEventListener(SimEventListener l)
Removes a SimEventListener from the list of listeners listening for SimEvents broadcast from this model. |
void |
setController(IController controller)
Sets the controller associated with this model |
void |
setRngSeed(long seed)
Sets the random number generator in Random to a new value. |
void |
stop()
Stops the simulation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface uchicago.src.sim.engine.SimModel |
|---|
begin, getInitParam, getName, getSchedule, setup |
| Field Detail |
|---|
protected java.util.Hashtable descriptors
ListPropertyDescriptor,
BooleanPropertyDescriptorprotected ModelManipulator modelManipulator
| Constructor Detail |
|---|
public SimModelImpl()
Random| Method Detail |
|---|
public void generateNewSeed()
generateNewSeed in interface SimModelpublic void setRngSeed(long seed)
setRngSeed in interface SimModelseed - the new rng seedRandompublic long getRngSeed()
getRngSeed in interface SimModelpublic double getTickCount()
getTickCount in interface SimModelpublic void setController(IController controller)
setController in interface SimModelcontroller - the controller to associate with this modelpublic IController getController()
getController in interface SimModelpublic java.lang.String getPropertiesValues()
MaxVision: 3 MaxMetabolism: 4 NumAgents: 52
getPropertiesValues in interface SimModelpublic ModelManipulator getModelManipulator()
getModelManipulator in interface SimModelpublic java.util.Vector getMediaProducers()
getMediaProducers in interface SimModel
public void registerDisplaySurface(java.lang.String name,
DisplaySurface surface)
public void registerMediaProducer(java.lang.String name,
MediaProducer media)
public void clearMediaProducers()
clearMediaProducers in interface SimModelpublic void clearPropertyListeners()
clearPropertyListeners in interface SimModelpublic java.util.Hashtable getParameterDescriptors()
getParameterDescriptors in interface DescriptorContainergetParameterDescriptors in interface SimModelpublic void addSimEventListener(SimEventListener l)
addSimEventListener in interface SimEventProducerl - the SimEventListener to addSimEventListenerpublic void removeSimEventListener(SimEventListener l)
removeSimEventListener in interface SimEventProducerl - the SimEventListener to remove.SimEventListenerpublic void fireSimEvent(SimEvent evt)
fireSimEvent in interface SimEventProducerevt - the SimEvent to broadcastSimEventprotected void addPropertyListener(PropertyListener listener)
listener - the PropertyListener to add.protected void removePropertyListener(PropertyListener listener)
listener - the PropertyListener to remove.public void pause()
public void stop()
public void fireNumericPropertyEvent(PropertyEvent evt)
evt - the PropertyEvent to broadcastpublic void fireStringPropertyEvent(PropertyEvent evt)
evt - the PropertyEvent to broadcastpublic void fireBooleanPropertyEvent(PropertyEvent evt)
evt - the PropertyEvent to broadcastpublic void fireObjectPropertyEvent(PropertyEvent evt)
evt - the PropertyEvent to broadcastprotected void fireStopSim()
protected void firePauseSim()
protected void fireEndSim()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||