Information Technology Reference
In-Depth Information
de.rsiegfried.grams.simulator
«interface»
Simulator
+now() : TimePoint
+scheduleAction(Action action)
+scheduleEvent(Event event)
+simulate(Model model)
«interface»
Simulator
+now() : TimePoint
+scheduleAction(Action action)
+scheduleEvent(Event event)
+simulate(Model model)
grams.simulator.singlethread
grams.simulator.singlethread
g
g
EventDrivenSimulator
EventDrivenSimulator
TimeSteppedSimulator
TimeSteppedSimulator
grams.simulator.multithread
grams.simulator.multithread
g
MultiThreadedEventDrivenSimulator
Figure 9.8: Class diagram of package simulator .
Actual classes implementing the interface Agent represent the dif-
ferent types of agents available in problem-specific models. The class
AbstractAgent provides a skeletal implementation of an agent to ease
implementation.
Two methods of an action are worth mentioning:
succeeded()
This method is called by a simulation engine if the execution of
this action was successfully. In this case, this method is responsible
for determining the state changes which have to be applied to the
model.
failed(TimeInterval done)
This method is called by a simulation engine and indicates that the
execution of this action failed after the amount of time specified by
the parameter done . Similarly to the case of a successful execution,
this method is responsible for determining the state changes which
have to be applied to the model.
9.3 Simulation engines
The starting point for implementing a simulation engine is the interface
Simulator (see Figure 9.8). Two different single-threaded implement-
Search WWH ::




Custom Search