Class SimulationControl

java.lang.Object
fr.ifremer.isisfish.simulator.SimulationControl
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class SimulationControl extends Object implements PropertyChangeListener
Permit to communicate with user interface from simulation thread. Created: Fri Oct 6 2000
Version:
$Revision$ Mise a jour: $Date$ par : $Author$
Author:
POUSSIN Benjamin <poussin@codelutin.com>
  • Field Details

    • listeners

      protected PropertyChangeSupport listeners
    • inUpdateFromProperties

      protected boolean inUpdateFromProperties
    • simulation

      protected transient SimulationStorage simulation
    • id

      protected String id
    • started

      protected boolean started
    • running

      protected boolean running
    • stop

      protected boolean stop
    • step

      protected TimeStep step
    • progressMax

      protected long progressMax
    • progress

      protected long progress
    • text

      protected String text
    • timeStepMeanTime

      protected double timeStepMeanTime
    • autoSaveState

      protected transient boolean autoSaveState
      Control save mecanism each time a property is changed (default to false).
  • Constructor Details

    • SimulationControl

      public SimulationControl(String id)
      Init simulation control with simulation id.
      Parameters:
      id - simulation id
  • Method Details

    • setAutoSaveState

      public void setAutoSaveState(boolean autoSaveState)
      Change auto save state on property change. Usefull to disable autosave in simulation monitoring.
      Parameters:
      autoSaveState - new state
    • isAutoSaveState

      public boolean isAutoSaveState()
      Get current auto save state.
      Returns:
      auto save state
    • reset

      public void reset()
      Reset control values for job restart.
    • getSimulation

      public SimulationStorage getSimulation()
      Retourne la simulation associe a ce control
      Returns:
      retourne null si la simulation n'existe pas encore
    • addPropertyChangeListener

      public void addPropertyChangeListener(String propName, PropertyChangeListener l)
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener l)
    • removePropertyChangeListener

      public void removePropertyChangeListener(String propName, PropertyChangeListener l)
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener l)
    • isStarted

      public boolean isStarted()
    • setStarted

      public void setStarted(boolean started)
      Appelee juste avant de reellement demarrer le thread de simulation indique que cette simulation est en cours et qu'il ne faut plus la lancer
      Parameters:
      started - The running to set.
    • isRunning

      public boolean isRunning()
      Method running.
      Returns:
      faux une fois que stopSimulation a ete appele.
    • startSimulation

      public void startSimulation()
      Appele lors du debut de la simulation.
    • stopSimulation

      public void stopSimulation()
      Appele lors de la fin reelle de la simulation.
    • getText

      public String getText()
      Returns:
      Returns the text.
    • setText

      public void setText(String text)
      Parameters:
      text - The text to set.
    • getProgressMax

      public long getProgressMax()
      Returns:
      Returns the progressMax.
    • setProgressMax

      public void setProgressMax(long progressMax)
      Set max progress.
      Parameters:
      progressMax - progressMax to set.
    • getProgress

      public long getProgress()
      Get current progress.
      Returns:
      the progress.
    • setProgress

      public void setProgress(long progress)
      Set current progress.
      Parameters:
      progress - progress to set.
    • setStopSimulationRequest

      public void setStopSimulationRequest(boolean val)
      Demande l'arret de la simulation.
      Parameters:
      val - true to stop
    • isStopSimulationRequest

      public boolean isStopSimulationRequest()
      Is stop request been asked.
      Returns:
      retourne vrai si l'arret de la simulation a ete demandee
    • getId

      public String getId()
      Method getId donne id de la simulation.
      Returns:
      l'id de la simulation
    • getStep

      public TimeStep getStep()
      Method getDate donne la date utiliser par la simulation.
      Returns:
      donne la date utiliser par la simulation
    • setStep

      public void setStep(TimeStep t)
      Modifie la date de la simulation.
      Parameters:
      t - la nouvelle etape
    • setTimeStepMeanTime

      public void setTimeStepMeanTime(double timeStepMeanTime)
      Set mean time for one step in second
      Parameters:
      timeStepMeanTime -
    • getTimeStepMeanTime

      public double getTimeStepMeanTime()
      Get mean time for one step in second
      Returns:
    • getProperties

      public Properties getProperties()
      Met dans un Properties tous les champs
      Returns:
      un Properties avec tous les champs
    • updateFromProperties

      public void updateFromProperties(Properties props)
      update current object from Properties representation
      Parameters:
      props - new properties to update from
    • propertyChange

      public void propertyChange(PropertyChangeEvent e)
      Specified by:
      propertyChange in interface PropertyChangeListener