Class ControllerForFxml

java.lang.Object
controller.ControllerForFxml
All Implemented Interfaces:
IControllerForM, IControllerForV, ISimulatorUI

public class ControllerForFxml extends Object implements IControllerForM, IControllerForV, ISimulatorUI
Controller class for handling the FXML UI interactions. Implements interfaces for communication with the simulation engine and visualization.
  • Constructor Details

    • ControllerForFxml

      public ControllerForFxml()
  • Method Details

    • initialize

      public void initialize()
      Initializes the controller, setting up the visualization and event handlers.
    • setIVisualization

      public void setIVisualization(IVisualization screen)
      Sets the visualization interface.
      Parameters:
      screen - the visualization interface
    • setUi

      public void setUi(ISimulatorUI ui)
      Sets the simulator UI interface.
      Parameters:
      ui - the simulator UI interface
    • getTime

      public double getTime()
      Returns the time of the simulation.
      Specified by:
      getTime in interface ISimulatorUI
      Returns:
      the time of the simulation
    • getDelay

      public long getDelay()
      Returns the delay of the simulation.
      Specified by:
      getDelay in interface ISimulatorUI
      Returns:
      the delay of the simulation
    • setEndTime

      public void setEndTime(double time)
      Sets the end time of the simulation.
      Specified by:
      setEndTime in interface ISimulatorUI
      Parameters:
      time - the end time of the simulation
    • updateSimulationTime

      public void updateSimulationTime(double time)
    • getVisualization

      public IVisualization getVisualization()
      Returns the visualization interface.
      Specified by:
      getVisualization in interface ISimulatorUI
      Returns:
      the visualization interface
    • startSimulation

      public void startSimulation()
      Starts the simulation with the specified time and delay.
      Specified by:
      startSimulation in interface IControllerForV
    • showEndTime

      public void showEndTime(double time)
      Shows the end time of the simulation.
      Specified by:
      showEndTime in interface IControllerForM
      Parameters:
      time - the end time of the simulation
    • visualizeCustomer

      public void visualizeCustomer(int customer, int listSize)
      Visualizes the specified customer.
      Specified by:
      visualizeCustomer in interface IControllerForM
      Parameters:
      customer - the customer to visualize
    • visualizeRemoveCustomers

      public void visualizeRemoveCustomers(int customer, int listSize)
      Removes the specified customer from the visualization.
      Specified by:
      visualizeRemoveCustomers in interface IControllerForM
      Parameters:
      customer - the customer to remove
    • updateServicePointSums

      public void updateServicePointSums(int c0, int c1, int c2, int c3, int c4, int c5, int q0, int q1, int q2, int q3, int q4, int q5)
      Updates the service point sums with the specified values.
      Specified by:
      updateServicePointSums in interface IControllerForM
      Parameters:
      c0 - the sum of customers at service point 0
      c1 - the sum of customers at service point 1
      c2 - the sum of customers at service point 2
      c3 - the sum of customers at service point 3
      c4 - the sum of customers at service point 4
      c5 - the sum of customers at service point 5
    • speedUp

      public void speedUp()
      Speeds up the simulation.
      Specified by:
      speedUp in interface IControllerForV
    • slowDown

      public void slowDown()
      Slows down the simulation.
      Specified by:
      slowDown in interface IControllerForV
    • updateTextArea

      public void updateTextArea(String message)
      Updates the console log text area with the specified message.
      Parameters:
      message - the message to append to the console log
    • openSettings

      public void openSettings()
      Opens the settings window.
    • openDatabaseWindow

      public void openDatabaseWindow()
      Opens the database window.
    • openAboutWindow

      public void openAboutWindow() throws IOException
      Opens the about window.
      Throws:
      IOException
    • resumeSimulation

      public void resumeSimulation()
      Resumes the simulation.