Class Controller

  • All Implemented Interfaces:
    Runnable

    public class Controller
    extends Thread
    This controller has been created to control the simulation in GUI-based environments.
    • Field Detail

      • coordinator

        protected Coordinator coordinator
        The coordinator of the simulation.
      • tF

        protected double tF
        The final time of the simulation.
    • Constructor Detail

      • Controller

        public Controller​(Coordinator coordinator)
        Creates a new controller with the given coordinator.
        Parameters:
        coordinator - the coordinator of the simulation.
    • Method Detail

      • startSimulation

        public void startSimulation​(double timeInterval)
        Starts the simulation, initializing the coordinator
        Parameters:
        timeInterval - Simulation time interval, in seconds
      • runSimulation

        public void runSimulation()
        Runs the simulation during a given time interval
      • pauseSimulation

        public void pauseSimulation()
        Pauses the simulation
      • resumeSimulation

        public void resumeSimulation()
        Resumes the simulation
      • stepSimulation

        public void stepSimulation()
        Performs a single step in the simulation loop
      • terminateSimulation

        public void terminateSimulation()
        Finishes the current simulation
      • simInject

        public void simInject​(double e,
                              Port<Object> port,
                              Collection<Object> values)
        Injects a value into the port "port", calling the transition function.
        Parameters:
        e - Elapsed time
        port - Input port
        values - Set of values
      • simInject

        public void simInject​(Port<Object> port,
                              Collection<Object> values)
        Injects a value into the port "port", calling the transition function.
        Parameters:
        port - Input port
        values - Set of values
      • simInject

        public void simInject​(double e,
                              Port<Object> port,
                              Object value)
        Injects a single value into the port "port", calling the transition function.
        Parameters:
        e - Elapsed time
        port - Input port
        value - value to inject
      • simInject

        public void simInject​(Port<Object> port,
                              Object value)
        Injects a single value into the port "port", calling the transition function.
        Parameters:
        port - Input port
        value - value to inject
      • getSimulationClock

        public SimulationClock getSimulationClock()
        Returns the simulation clock.
        Returns:
        the simulation clock
      • run

        public void run()
        Specified by:
        run in interface Runnable
        Overrides:
        run in class Thread