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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonggetDelay()Returns the delay of the simulation.doublegetTime()Returns the time of the simulation.Returns the visualization interface.voidInitializes the controller, setting up the visualization and event handlers.voidOpens the about window.voidOpens the database window.voidOpens the settings window.voidResumes the simulation.voidsetEndTime(double time) Sets the end time of the simulation.voidsetIVisualization(IVisualization screen) Sets the visualization interface.voidsetUi(ISimulatorUI ui) Sets the simulator UI interface.voidshowEndTime(double time) Shows the end time of the simulation.voidslowDown()Slows down the simulation.voidspeedUp()Speeds up the simulation.voidStarts the simulation with the specified time and delay.voidupdateServicePointSums(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.voidupdateSimulationTime(double time) voidupdateTextArea(String message) Updates the console log text area with the specified message.voidvisualizeCustomer(int customer, int listSize) Visualizes the specified customer.voidvisualizeRemoveCustomers(int customer, int listSize) Removes the specified customer from the visualization.
-
Constructor Details
-
ControllerForFxml
public ControllerForFxml()
-
-
Method Details
-
initialize
public void initialize()Initializes the controller, setting up the visualization and event handlers. -
setIVisualization
Sets the visualization interface.- Parameters:
screen- the visualization interface
-
setUi
Sets the simulator UI interface.- Parameters:
ui- the simulator UI interface
-
getTime
public double getTime()Returns the time of the simulation.- Specified by:
getTimein interfaceISimulatorUI- Returns:
- the time of the simulation
-
getDelay
public long getDelay()Returns the delay of the simulation.- Specified by:
getDelayin interfaceISimulatorUI- Returns:
- the delay of the simulation
-
setEndTime
public void setEndTime(double time) Sets the end time of the simulation.- Specified by:
setEndTimein interfaceISimulatorUI- Parameters:
time- the end time of the simulation
-
updateSimulationTime
public void updateSimulationTime(double time) -
getVisualization
Returns the visualization interface.- Specified by:
getVisualizationin interfaceISimulatorUI- Returns:
- the visualization interface
-
startSimulation
public void startSimulation()Starts the simulation with the specified time and delay.- Specified by:
startSimulationin interfaceIControllerForV
-
showEndTime
public void showEndTime(double time) Shows the end time of the simulation.- Specified by:
showEndTimein interfaceIControllerForM- Parameters:
time- the end time of the simulation
-
visualizeCustomer
public void visualizeCustomer(int customer, int listSize) Visualizes the specified customer.- Specified by:
visualizeCustomerin interfaceIControllerForM- Parameters:
customer- the customer to visualize
-
visualizeRemoveCustomers
public void visualizeRemoveCustomers(int customer, int listSize) Removes the specified customer from the visualization.- Specified by:
visualizeRemoveCustomersin interfaceIControllerForM- 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:
updateServicePointSumsin interfaceIControllerForM- Parameters:
c0- the sum of customers at service point 0c1- the sum of customers at service point 1c2- the sum of customers at service point 2c3- the sum of customers at service point 3c4- the sum of customers at service point 4c5- the sum of customers at service point 5
-
speedUp
-
slowDown
public void slowDown()Slows down the simulation.- Specified by:
slowDownin interfaceIControllerForV
-
updateTextArea
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
-
resumeSimulation
public void resumeSimulation()Resumes the simulation.
-