|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSim.Simulation
public class Simulation
Simulation is the core of the discrete event simulation. It holds the current simulation time and
all of the events. Events are scheduled through the scheduleEvent(double,
SimulationEvent)
method.
Constructor Summary | |
---|---|
Simulation(SimulationParameters p)
Constructs a new Simulation with the given parameters. |
Method Summary | |
---|---|
void |
cancelEvents(java.lang.Class eventType)
Cancels all events in the Simulation that match a certain type. |
java.lang.String |
getName()
Returns the name of this Simulation. |
SimulationParameters |
getParams()
Returns global simulation parameters that are set at the beginning of the simulation and never change throughout the execution. |
java.util.Random |
getRng()
Returns the source of randomness for this Simulation. |
double |
getTime()
Returns the current simulation time, which can stand still but never go backwards. |
World |
getWorld()
Returns the World associated with this Simulation. |
boolean |
next()
Performs the next event in this Simulation. |
void |
scheduleEvent(double t,
SimulationEvent event)
Schedules a new event to take place in the future. |
void |
setName(java.lang.String name)
Sets this Simulation's name |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Simulation(SimulationParameters p)
p
- non-null SimulationParametersMethod Detail |
---|
public World getWorld()
public java.util.Random getRng()
public SimulationParameters getParams()
public java.lang.String getName()
public void setName(java.lang.String name)
public boolean next()
public double getTime()
public void cancelEvents(java.lang.Class eventType)
eventType
- non-null event type classpublic void scheduleEvent(double t, SimulationEvent event)
t
- event time greater than or equal to the current simulation timeevent
- non-null SimulationEvent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |