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
ConstructorDescriptionBasicSimulator
(BasicDomain root, EventQueue<Agent> queue, MessageForwardingStrategy forwarding) Constructs a new simulator with given model, queue implementation and messaging strategy -
Method Summary
Modifier and TypeMethodDescriptionvoid
registerEventsProcessedListener
(Listener<Simulator> listener) Registers anEventsProcessedListener
to be called after each simulation cycle.abstract void
runSimulation
(Time stop) Starts a simulation runvoid
unregisterEventsProcessedListener
(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:
runSimulation
in interfaceSimulator
- Parameters:
stop
- simulation time when the simulation should stop- Throws:
Simulator.InvalidSimulatorStateException
- if there is an error during simulation
-
getRootDomain
- Specified by:
getRootDomain
in interfaceSimulator
-
getSimulationTime
- Specified by:
getSimulationTime
in interfaceSimulator
-
registerEventsProcessedListener
Description copied from interface:Simulator
Registers anEventsProcessedListener
to be called after each simulation cycle.- Specified by:
registerEventsProcessedListener
in interfaceSimulator
- Parameters:
listener
- theListener
implementation to be added
-
unregisterEventsProcessedListener
Description copied from interface:Simulator
Unregisters anEventsProcessedListener
.- Specified by:
unregisterEventsProcessedListener
in interfaceSimulator
- Parameters:
listener
- theListener
implementation to be removed
-
getCurrentEventList
- Specified by:
getCurrentEventList
in interfaceSimulator
-