Package org.simplesim.simulator
Class BasicSimulator
java.lang.Object
org.simplesim.simulator.BasicSimulator
- All Implemented Interfaces:
Simulator
- Direct Known Subclasses:
SequentialDESimulator,SequentialTSSimulator
Implements the core functionality of a simulator.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.simplesim.simulator.Simulator
Simulator.InvalidSimulatorStateException -
Constructor Summary
ConstructorsConstructorDescriptionBasicSimulator(BasicDomain root, EventQueue<Agent> queue, MessageForwardingStrategy forwarding) Constructs a new simulator with given model, queue implementation and messaging strategy -
Method Summary
Modifier and TypeMethodDescriptionvoidregisterEventsProcessedListener(Listener<Simulator> listener) Registers anEventsProcessedListenerto be called after each simulation cycle.abstract voidrunSimulation(Time stop) Starts a simulation runvoidunregisterEventsProcessedListener(Listener<Simulator> listener) Unregisters anEventsProcessedListener.
-
Constructor Details
-
BasicSimulator
public BasicSimulator(BasicDomain root, EventQueue<Agent> queue, MessageForwardingStrategy forwarding) Constructs a new simulator with given model, queue implementation and messaging strategy- Parameters:
root- the root domain of the modelqueue- the queue implementation to use as global event queueforwarding- the strategy to use for message forwarding
-
-
Method Details
-
runSimulation
Starts a simulation run- Specified by:
runSimulationin interfaceSimulator- Parameters:
stop- simulation time when the simulation should stop- Throws:
Simulator.InvalidSimulatorStateException- if there is an error during simulation
-
getRootDomain
- Specified by:
getRootDomainin interfaceSimulator
-
getSimulationTime
- Specified by:
getSimulationTimein interfaceSimulator
-
registerEventsProcessedListener
Description copied from interface:SimulatorRegisters anEventsProcessedListenerto be called after each simulation cycle.- Specified by:
registerEventsProcessedListenerin interfaceSimulator- Parameters:
listener- theListenerimplementation to be added
-
unregisterEventsProcessedListener
Description copied from interface:SimulatorUnregisters anEventsProcessedListener.- Specified by:
unregisterEventsProcessedListenerin interfaceSimulator- Parameters:
listener- theListenerimplementation to be removed
-
getCurrentEventList
- Specified by:
getCurrentEventListin interfaceSimulator
-