m865.simulation
Class DepartmentStore

java.lang.Object
  extended by m865.simulation.DepartmentStore

public class DepartmentStore
extends java.lang.Object

The DepartmentStore has a main method which sets up and starts the simulation. The DepartmentStore object manages the entities in the simulation and shuts the simulation down when there are no more events.


Field Summary
 ButtonSystem buttonSystem
          The ButtonSystem that records the interests of passengers who are waiting for elevators
static int CAPACITY
          Symbolic constants that define various simulation parameters
 Clock clock
          The clock keeps track of the simulation time and insures that events occur in the proper order and at the proper times.
 java.util.ArrayList<BalkingQueue> elevatorQueues
          The array of queues that hold the passengers who are waiting for elevators.
 Elevator[] elevators
          The array of Elevators
 int elevatorTransitTime
          The time for an elevator to move from one floor to the next
static int LOADTIME
           
 int numberOfElevators
          The number of elevators
 int numberOfFloors
          The number of floors
static int OFFLOADTIME
           
 PassengerFactory passengerFactory
          The factory that generates the people, sets up their shopping tasks, and schedules their arrival events.
static int QUIET
          Symbolic constants to indicate the verbosity level
 Statistician statistician
          The class which collects the Passenger and teller statistics and generates the simulation report.
static int VERBOSE
           
 int verbosity
          verbosity indicates the level of information that gets printed out.
static int VERY_VERBOSE
           
 
Constructor Summary
DepartmentStore(int v, int nf, int ne, int tt, PassengerFactory pf)
          The constructor for the DepartmentStore.
 
Method Summary
 BalkingQueue getQueue(int floor, boolean goingUp)
          Get an elevator queue
static void main(java.lang.String[] args)
          The main method sets up the simulation.
 void run()
          The run method runs the simulation.
 java.lang.String toString()
          the toString method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

QUIET

public static final int QUIET
Symbolic constants to indicate the verbosity level

See Also:
Constant Field Values

VERBOSE

public static final int VERBOSE
See Also:
Constant Field Values

VERY_VERBOSE

public static final int VERY_VERBOSE
See Also:
Constant Field Values

CAPACITY

public static final int CAPACITY
Symbolic constants that define various simulation parameters

See Also:
Constant Field Values

OFFLOADTIME

public static final int OFFLOADTIME
See Also:
Constant Field Values

LOADTIME

public static final int LOADTIME
See Also:
Constant Field Values

passengerFactory

public PassengerFactory passengerFactory
The factory that generates the people, sets up their shopping tasks, and schedules their arrival events.


clock

public Clock clock
The clock keeps track of the simulation time and insures that events occur in the proper order and at the proper times. From the point of view of the DepartmentStore the clock is the iterator over the set of events.


numberOfFloors

public int numberOfFloors
The number of floors


numberOfElevators

public int numberOfElevators
The number of elevators


elevatorTransitTime

public int elevatorTransitTime
The time for an elevator to move from one floor to the next


elevators

public Elevator[] elevators
The array of Elevators


elevatorQueues

public java.util.ArrayList<BalkingQueue> elevatorQueues
The array of queues that hold the passengers who are waiting for elevators.


buttonSystem

public ButtonSystem buttonSystem
The ButtonSystem that records the interests of passengers who are waiting for elevators


statistician

public Statistician statistician
The class which collects the Passenger and teller statistics and generates the simulation report.


verbosity

public int verbosity
verbosity indicates the level of information that gets printed out. QUIET indicates that the DepartmentStore only prints out a final report.
VERBOSE indicates that the DepartmentStore should also print out each event as it occurs.
VERY_VERBOSE indicates that the DepartmentStore should also have the Clock dump its schedule each time as well

Constructor Detail

DepartmentStore

public DepartmentStore(int v,
                       int nf,
                       int ne,
                       int tt,
                       PassengerFactory pf)
The constructor for the DepartmentStore. It creates the following classes that are owned by the DepartmentStore: Clock, PassengerQueue, TellerQueue, and Statistician.

Parameters:
v - The flag that indicates how verbose the simulation should be.
Method Detail

run

public void run()
The run method runs the simulation. It invokes the PassengerFactory and tellerFactory to initialize the arrival events. Then it executes the following simple loop: while there is an event, get the event and tell it to fire. If the verbose flag it set, then information about each event will be printed out.


getQueue

public BalkingQueue getQueue(int floor,
                             boolean goingUp)
Get an elevator queue

Parameters:
floor - -The floor using conventional ordinal numbers (1, 2, etc.)
goingUp - A boolean true for going up and false for going down
Returns:
The queue for that floor and direction.

toString

public java.lang.String toString()
the toString method.

Overrides:
toString in class java.lang.Object
Returns:
a string describing the DepartmentStore.

main

public static void main(java.lang.String[] args)
The main method sets up the simulation.

Parameters:
args - The list of arguments needed to set up the simulation.