Class ElevatorSimulation

java.lang.Object
  extended by ElevatorSimulation

public class ElevatorSimulation
extends Object

Simulates the operation of a bank of elevators. This simulation was inspired by waiting for an elevator at the Marriott Marquis Times Square elevator bank, seen here.

The Javadoc for this project was generated with the following command:


 $ javadoc -d html -private -link http://download.oracle.com/javase/6/docs/api/ *.java
 


Nested Class Summary
private  class ElevatorSimulation.Control
          Provides simple keyboard control to the simulation by implementing the KeyListener interface.
private static class ElevatorSimulation.PlayState
           
 
Field Summary
private  ElevatorBank bank
           
private  LandscapeDisplay display
           
private  int iteration
           
private  Landscape landscape
           
private  int pause
           
private  ElevatorSimulation.PlayState state
           
private  JLabel textMessage
           
 
Constructor Summary
ElevatorSimulation(int lifts, int floors, int capacity)
          Initializes an elevator simulation.
 
Method Summary
 void iterate()
          Implements one iteration (time step) of the elevator simulation.
static void main(String[] args)
          Runs an elevator simulation.
private  void setupUI()
          Sets up the UI controls for the elevator simulation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bank

private ElevatorBank bank

landscape

private Landscape landscape

display

private LandscapeDisplay display

textMessage

private JLabel textMessage

state

private ElevatorSimulation.PlayState state

iteration

private int iteration

pause

private int pause
Constructor Detail

ElevatorSimulation

public ElevatorSimulation(int lifts,
                          int floors,
                          int capacity)
Initializes an elevator simulation. Creates an elevator bank and populates a landscape with the elevators.

Parameters:
lifts - the number of elevators in the simulation
floors - the number of floors in the simulation
capacity - the passenger capacity of each elevator
Method Detail

setupUI

private void setupUI()
Sets up the UI controls for the elevator simulation.


iterate

public void iterate()
Implements one iteration (time step) of the elevator simulation.


main

public static void main(String[] args)
Runs an elevator simulation.

Parameters:
args -