Class OwnEngine
java.lang.Object
java.lang.Thread
simu.framework.Engine
simu.model.OwnEngine
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsFields inherited from class simu.framework.Engine
controller, eventListFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionOwnEngine(IControllerForM controller, ControllerForFxml controllerFxml, SettingsController settingsController) Constructs an OwnEngine with the specified controller, controller for FXML, and settings controller. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAttempts to run the C events.Calculates the performance metrics of the simulation.voidchangeArrivalMean(double mean) Changes the mean of the arrival process.voidchangeEatingMean(double mean) Changes the mean of the eating process.voidchangeExitingMean(double mean) Changes the mean of the exiting process.voidchangeOrderingMean(double mean) Changes the mean of the ordering process.voidchangeSeatingMean(double mean) Changes the mean of the seating process.voidchangeServiceMean(double mean) Changes the mean of the service process.protected voidinit()Initializes the simulation.voidPauses the simulation.intrandChance(int chance) Returns random number between 0 and chance.protected voidresults()Results of the simulation.voidResumes the simulation.protected voidRuns the event.Methods inherited from class simu.framework.Engine
getDelay, run, setDelay, setSimulationTimeMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, toString, yield
-
Field Details
-
MAX_CUSTOMERS
public static final int MAX_CUSTOMERS- See Also:
-
-
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 simulationcontrollerFxml- the controller for FXML used to manage the simulationsettingsController- 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
-
runEvent
-
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:
attemptCEventsin classEngine
-
results
-
calculatePerformanceMetrics
-