Class ProbeExecutionTracker
- java.lang.Object
-
- fr.univ_artois.lgi2a.similar.microkernel.libs.probes.ProbeExecutionTracker
-
- All Implemented Interfaces:
IProbe
public class ProbeExecutionTracker extends Object implements IProbe
This probe tracks the execution of the simulation and prints notification messages in a stream printer.- Author:
- Yoann Kubera, Gildas Morvan
-
-
Constructor Summary
Constructors Constructor Description ProbeExecutionTracker(PrintStream target)
Creates an instance of this probe writing in a specific print stream.ProbeExecutionTracker(PrintStream target, boolean printSteps)
Creates an instance of this probe writing in a specific print stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
endObservation()
Ends the observation of a simulation.void
observeAtFinalTime(SimulationTimeStamp finalTimestamp, ISimulationEngine simulationEngine)
Observes the state of the simulation when the final time stamp of the simulation is reached.void
observeAtInitialTimes(SimulationTimeStamp initialTimestamp, ISimulationEngine simulationEngine)
Observes the state of the simulation when the initial time stamp is reached.void
observeAtPartialConsistentTime(SimulationTimeStamp timestamp, ISimulationEngine simulationEngine)
Observes the state of the simulation when at least one level is in a consistent state.void
prepareObservation()
Prepares the observation of a simulation.void
reactToAbortion(SimulationTimeStamp timestamp, ISimulationEngine simulationEngine)
Reacts to the abortion of a currently running simulation.void
reactToError(String errorMessage, Throwable cause)
Reacts to an error thrown by the simulation engine.
-
-
-
Constructor Detail
-
ProbeExecutionTracker
public ProbeExecutionTracker(PrintStream target, boolean printSteps)
Creates an instance of this probe writing in a specific print stream.- Parameters:
target
- The stream where the data are written.printSteps
-true
if the verbose mode has to include the simulation steps.- Throws:
IllegalArgumentException
- If thetarget
isnull
.
-
ProbeExecutionTracker
public ProbeExecutionTracker(PrintStream target)
Creates an instance of this probe writing in a specific print stream.- Parameters:
target
- The stream where the data are written.- Throws:
IllegalArgumentException
- If thetarget
isnull
.
-
-
Method Detail
-
prepareObservation
public void prepareObservation()
Prepares the observation of a simulation.This method is defined to open the streams or the other resources used during the observation of one simulation.
- Specified by:
prepareObservation
in interfaceIProbe
-
observeAtInitialTimes
public void observeAtInitialTimes(SimulationTimeStamp initialTimestamp, ISimulationEngine simulationEngine)
Observes the state of the simulation when the initial time stamp is reached.- Specified by:
observeAtInitialTimes
in interfaceIProbe
- Parameters:
initialTimestamp
- The initial time stamp of the simulation.simulationEngine
- The simulation engine embedding the currently running simulation and the current dynamic state of the various levels of the simulation.
-
observeAtPartialConsistentTime
public void observeAtPartialConsistentTime(SimulationTimeStamp timestamp, ISimulationEngine simulationEngine)
Observes the state of the simulation when at least one level is in a consistent state.- Specified by:
observeAtPartialConsistentTime
in interfaceIProbe
- Parameters:
timestamp
- The time stamp for which at least one level of the simulation is a consistent state.simulationEngine
- The simulation engine embedding the currently running simulation and the current dynamic state of the various levels of the simulation.
-
observeAtFinalTime
public void observeAtFinalTime(SimulationTimeStamp finalTimestamp, ISimulationEngine simulationEngine)
Observes the state of the simulation when the final time stamp of the simulation is reached.- Specified by:
observeAtFinalTime
in interfaceIProbe
- Parameters:
finalTimestamp
- The final time stamp of the simulation.simulationEngine
- The simulation engine embedding the currently running simulation and the current dynamic state of the various levels of the simulation.
-
endObservation
public void endObservation()
Ends the observation of a simulation.This method is defined to close the streams or the other resources used during the observation of one simulation.
- Specified by:
endObservation
in interfaceIProbe
-
reactToError
public void reactToError(String errorMessage, Throwable cause)
Reacts to an error thrown by the simulation engine.- Specified by:
reactToError
in interfaceIProbe
cause
- The cause of the error.
-
reactToAbortion
public void reactToAbortion(SimulationTimeStamp timestamp, ISimulationEngine simulationEngine)
Reacts to the abortion of a currently running simulation.- Specified by:
reactToAbortion
in interfaceIProbe
- Parameters:
timestamp
- The time stamp reached right after the moment when the abortion was requested.simulationEngine
- The simulation engine embedding the aborted simulation and the dynamic state of the various levels of the simulation after abortion.
-
-