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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidregisterEventsProcessedListener(Listener<Simulator> listener) Registers anEventsProcessedListenerto be called after each simulation cycle.voidrunSimulation(Time stop) Starts a simulation runvoidunregisterEventsProcessedListener(Listener<Simulator> listener) Unregisters anEventsProcessedListener.
-
Constructor Details
-
DynamicDecorator
-
-
Method Details
-
runSimulation
Description copied from interface:SimulatorStarts a simulation run- Specified by:
runSimulationin interfaceSimulator- Parameters:
stop- simulation time when the simulation should stop
-
getRootDomain
- Specified by:
getRootDomainin interfaceSimulator
-
getSimulationTime
- Specified by:
getSimulationTimein interfaceSimulator
-
getCurrentEventList
- Specified by:
getCurrentEventListin 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
-