Class 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 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 the target is null.
      • 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 the target is null.
    • 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 interface IProbe
      • 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 interface IProbe
        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 interface IProbe
        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 interface IProbe
        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 interface IProbe
      • reactToError

        public void reactToError​(String errorMessage,
                                 Throwable cause)
        Reacts to an error thrown by the simulation engine.
        Specified by:
        reactToError in interface IProbe
        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 interface IProbe
        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.