Class OwnEngine

All Implemented Interfaces:
Runnable, IEngine

public class OwnEngine extends Engine
The OwnEngine class represents the simulation engine for the restaurant simulation. It extends the Engine class and contains the main logic for the simulation. The engine manages the simulation time, event list, and the execution of events. The engine also contains the service points and the arrival process for the simulation. The engine is responsible for generating events and running the simulation. The engine also calculates performance metrics for the simulation. The engine is used by the controller to manage the simulation.
  • Field Details

  • Constructor Details

    • OwnEngine

      public OwnEngine(IControllerForM controller, ControllerForFxml controllerFxml, SettingsController settingsController)
      Constructs an OwnEngine with the specified controller, controller for FXML, and settings controller. The engine also creates the service points and the arrival process for the simulation.
      Parameters:
      controller - the controller used to manage the simulation
      controllerFxml - the controller for FXML used to manage the simulation
      settingsController - the settings controller used to manage the simulation settings
  • Method Details

    • pauseSimulation

      public void pauseSimulation()
      Pauses the simulation.
    • resumeSimulation

      public void resumeSimulation()
      Resumes the simulation.
    • randChance

      public int randChance(int chance)
      Returns random number between 0 and chance.
      Parameters:
      chance -
      Returns:
      random number
    • changeArrivalMean

      public void changeArrivalMean(double mean)
      Changes the mean of the arrival process.
      Parameters:
      mean -
    • changeSeatingMean

      public void changeSeatingMean(double mean)
      Changes the mean of the seating process.
      Parameters:
      mean -
    • changeOrderingMean

      public void changeOrderingMean(double mean)
      Changes the mean of the ordering process.
      Parameters:
      mean -
    • changeServiceMean

      public void changeServiceMean(double mean)
      Changes the mean of the service process.
      Parameters:
      mean -
    • changeEatingMean

      public void changeEatingMean(double mean)
      Changes the mean of the eating process.
      Parameters:
      mean -
    • changeExitingMean

      public void changeExitingMean(double mean)
      Changes the mean of the exiting process.
      Parameters:
      mean -
    • init

      protected void init()
      Initializes the simulation. Generates the first arrival in the system.
      Specified by:
      init in class Engine
    • runEvent

      protected void runEvent(Event t)
      Runs the event.
      Specified by:
      runEvent in class Engine
      Parameters:
      t - the event to run
    • attemptCEvents

      protected void attemptCEvents()
      Attempts to run the C events. If the service point is not reserved and the customer is in the queue, the customer begins service.
      Specified by:
      attemptCEvents in class Engine
    • results

      protected void results()
      Results of the simulation.
      Specified by:
      results in class Engine
    • calculatePerformanceMetrics

      public Map<String,Double> calculatePerformanceMetrics()
      Calculates the performance metrics of the simulation.