Class ProbeImageSwingJFrame

    • Constructor Detail

      • ProbeImageSwingJFrame

        public ProbeImageSwingJFrame​(String frameTitle,
                                     AbstractProbeImageSwingJPanel simulationPainter,
                                     ProbeImageSwingJFrame.ClosingManagementStrategy closureStrategy,
                                     Dimension preferredDimensions)
        Builds the frame where the simulation is being printed on screen using a swing image. This frame ensures that its content matches the provided preferred dimensions.
        Parameters:
        frameTitle - The title of the frame being displayed on screen.
        simulationPainter - The object building the image of the simulation.
        closureStrategy - Defines what to do when the frame is closed by the user.
        preferredDimensions - Either the dimensions of the content of the frame or null if the frame is automatically resized.
        Throws:
        IllegalArgumentException - if either frameTitle or simulationPainter are null.
      • ProbeImageSwingJFrame

        public ProbeImageSwingJFrame​(String frameTitle,
                                     AbstractProbeImageSwingJPanel simulationPainter)
        Builds the frame where the simulation is being printed on screen using a swing image. This frame ensures that its content is resized automatically. When this frame is closed, the application will still wait for the simulation to end before stopping the program.
        Parameters:
        frameTitle - The title of the frame being displayed on screen.
        simulationPainter - The object building the image of the simulation.
        Throws:
        IllegalArgumentException - if either frameTitle or simulationPainter are 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.
      • 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.
      • 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