cmsc433.p2
Class Simulation
java.lang.Object
cmsc433.p2.Simulation
public class Simulation
- extends java.lang.Object
Simulation is the main class used to run the simulation. You may
add any fields (static or instance) or any methods you wish.
|
Method Summary |
static void |
logEvent(SimulationEvent event)
|
static void |
main(java.lang.String[] args)
Entry point for the simulation. |
static java.util.List<SimulationEvent> |
runSimulation(int numEaters,
int numCooks,
int numTables,
int machineCapacity)
Function responsible for performing the simulation. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Simulation
public Simulation()
logEvent
public static void logEvent(SimulationEvent event)
runSimulation
public static java.util.List<SimulationEvent> runSimulation(int numEaters,
int numCooks,
int numTables,
int machineCapacity)
- Function responsible for performing the simulation. Returns a List of
SimulationEvent objects, constructed any way you see fit. This List will
be validated by a call to Validate.validateSimulation. This method is called
from Simulation.main(). We should be able to test your code by only calling
runSimulation.
- Parameters:
numEaters - the number of eaters wanting to enter the restaurantnumCooks - the number of cooks in the simulationnumTables - the number of tables in the restaurant (i.e. restaurant capacity)machineCapacity - the capicity of all machines in the restaurant
main
public static void main(java.lang.String[] args)
throws java.lang.InterruptedException
- Entry point for the simulation. All simulation code, however, should be
in runSimulation, so that we can test your simulation by only calling
runSimulation() then Validate.validateSimulation. This means that most
code from your original Simulation.main should probably now be in
Simulation.runSimulation.
- Parameters:
args - the command-line arguments for the simulation. There
should be exactly four arguments: the first is the number of eaters,
the second is the number of cooks, the third is the number of tables
in the restaurant, and the fourth is the number of items each cooking
machine can make at the same time.
- Throws:
java.lang.InterruptedException