Class SimulationManager

  • All Implemented Interfaces:
    Runnable

    public class SimulationManager
    extends Object
    implements Runnable
    Changes in simulations can be observed by tagging AutomatonNodes of the AutomatonGraph. As a standard implementation there is the FlatUpdateRecorder that can be added to the Simulation that will write log files to the specified file locations.
    Author:
    cl
    • Constructor Detail

      • SimulationManager

        public SimulationManager​(Simulation simulation)
        Creates a new simulation manager for the given simulation.
        Parameters:
        simulation - The simulation.
    • Method Detail

      • addNodeUpdateListener

        public void addNodeUpdateListener​(bio.singa.core.events.UpdateEventListener<UpdatableUpdatedEvent> listener)
        Adds a new listener for node based events.
        Parameters:
        listener - The listener.
      • getNodeListeners

        public CopyOnWriteArrayList<bio.singa.core.events.UpdateEventListener<UpdatableUpdatedEvent>> getNodeListeners()
        Returns all currently registered node event listeners.
        Returns:
        All currently registered node event listeners.
      • addGraphUpdateListener

        public void addGraphUpdateListener​(bio.singa.core.events.UpdateEventListener<GraphUpdatedEvent> listener)
        Adds a new listener for graph based events.
        Parameters:
        listener - The listener.
      • setTerminationCondition

        public void setTerminationCondition​(Predicate<Simulation> terminationCondition)
        Sets a condition determining when the simulation should be terminated.
        Parameters:
        terminationCondition - The termination condition.
      • setSimulationTerminationToTime

        public void setSimulationTerminationToTime​(javax.measure.Quantity<javax.measure.quantity.Time> time)
        Schedules the termination of the simulation after the given time (simulation time) has passed.
        Parameters:
        time - The time.
      • setSimulationTerminationToEpochs

        public void setSimulationTerminationToEpochs​(long numberOfEpochs)
        Schedules the termination of the simulation after the given number of epochs have passed.
        Parameters:
        numberOfEpochs - The number of epochs.
      • setUpdateEmissionCondition

        public void setUpdateEmissionCondition​(Predicate<Simulation> emitCondition)
        Sets a condition determining when events should be emitted.
        Parameters:
        emitCondition - The emission condition.
      • tieUpdateEmissionToFPS

        public void tieUpdateEmissionToFPS​(int fps)
        Sets the emission of updates for a rending engine. If more epochs are processed than can be displayed the epochs in between are not emitted. If epoch calculation is slower each epoch is emitted.
        Parameters:
        fps - The frames (emits) per (real time) second.
      • setUpdateEmissionToTimePassed

        public void setUpdateEmissionToTimePassed​(javax.measure.Quantity<javax.measure.quantity.Time> timePassed)
        Schedules the emission of events after the given time (simulation time) has passed.
        Parameters:
        timePassed - The (simulation) time passed.
      • setTerminationLatch

        public void setTerminationLatch​(CountDownLatch terminationLatch)
      • emitGraphEvent

        public void emitGraphEvent​(Simulation simulation)
      • keepPlatformOpen

        public boolean keepPlatformOpen()
      • setKeepPlatformOpen

        public void setKeepPlatformOpen​(boolean keepPlatformOpen)
      • isWritingAliveFile

        public boolean isWritingAliveFile()
      • setWriteAliveFile

        public void setWriteAliveFile​(boolean writeAliveFile)
      • getTargetPath

        public Path getTargetPath()
      • setTargetPath

        public void setTargetPath​(Path targetPath)
      • getSimulation

        public Simulation getSimulation()
        Returns the simulation.
        Returns:
        The simulation.
      • run

        public void run()
        Specified by:
        run in interface Runnable