Package org.simplesim.simulator
Class DynamicDecorator
java.lang.Object
org.simplesim.simulator.DynamicDecorator
- All Implemented Interfaces:
Simulator
Decorator class to enable dynamic changes of the model during simulation run.
This class wraps any other simulator implementation and registers itself as
EventsProcessedListener
to be called after each simulation cycle.
Communication of the agents' change requests is done by a static and
thread-safe queue within the AbstractAgent
class. Changes are done by
concrete implementations of the ChangeRequest
interface. So, agents
prepare and organize the change process whereas the the various change
request implementations are responsible for the conduct of the specified
model change. This class ensures the processing of the change requests.
To use model change functionality, agents have to issue change request via
AbstractAgent#addModelChangeRequest(ChangeRequest)
class.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.simplesim.simulator.Simulator
Simulator.InvalidSimulatorStateException
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
registerEventsProcessedListener
(Listener<Simulator> listener) Registers anEventsProcessedListener
to be called after each simulation cycle.void
runSimulation
(Time stop) Starts a simulation runvoid
unregisterEventsProcessedListener
(Listener<Simulator> listener) Unregisters anEventsProcessedListener
.
-
Constructor Details
-
DynamicDecorator
-
-
Method Details
-
runSimulation
Description copied from interface:Simulator
Starts a simulation run- Specified by:
runSimulation
in interfaceSimulator
- Parameters:
stop
- simulation time when the simulation should stop
-
getRootDomain
- Specified by:
getRootDomain
in interfaceSimulator
-
getSimulationTime
- Specified by:
getSimulationTime
in interfaceSimulator
-
getCurrentEventList
- Specified by:
getCurrentEventList
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
-