edu.lmu.liftor
Class Elevator

java.lang.Object
  |
  +--edu.lmu.liftor.Place.PlaceImpl
        |
        +--edu.lmu.liftor.Elevator
All Implemented Interfaces:
Place, java.lang.Runnable

public class Elevator
extends Place.PlaceImpl
implements java.lang.Runnable

An Elevator is a special kind of place that moves among Landings.


Nested Class Summary
static class Elevator.Landing
          A part of a floor that an Elevator may interact with.
 
Nested classes inherited from class edu.lmu.liftor.Place
Place.PlaceFullException, Place.PlaceImpl
 
Field Summary
static int BOARDING_DELAY
          How long the elevator waits for people to board and exit.
 Building building
          What building this elevator is in.
static int DEFAULT_ELEVATOR_CAPACITY
          This is the maximum capacity of the elevators
static int MOVEMENT_DELAY
          How long it takes to move to a floor.
 
Fields inherited from interface edu.lmu.liftor.Place
LIMBO
 
Constructor Summary
Elevator(Building where, java.util.List landings)
          Construct a new elevator in the given building with the given list of landings.
 
Method Summary
 Floor getCurrentFloor()
          Get the floor that this elevator is currently at.
 boolean isGoingUp()
          Is this elevator going up?
 void notifyPassengersOfArrival(Elevator.Landing l)
           
 void pushButton(Floor floor)
           
 void run()
          This is the runner! It runs and runs and never gets tired.
 void start()
           
 java.lang.String toString()
           
 void waitForFloor(Floor f)
          Wait for a specific floor to be reached.
 Floor waitForNextFloor()
          Wait for any floor to be reached by the elevator.
 
Methods inherited from class edu.lmu.liftor.Place.PlaceImpl
enter, exit, getPlaceCapacity, getPlaceName, getVisitorCount, isFull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

building

public final Building building
What building this elevator is in.


DEFAULT_ELEVATOR_CAPACITY

public static final int DEFAULT_ELEVATOR_CAPACITY
This is the maximum capacity of the elevators

See Also:
Constant Field Values

MOVEMENT_DELAY

public static final int MOVEMENT_DELAY
How long it takes to move to a floor.

See Also:
Constant Field Values

BOARDING_DELAY

public static final int BOARDING_DELAY
How long the elevator waits for people to board and exit.

See Also:
Constant Field Values
Constructor Detail

Elevator

public Elevator(Building where,
                java.util.List landings)
Construct a new elevator in the given building with the given list of landings. The list of landings is presumed to be sorted in ascending order. At least that's how it will be treated.

Method Detail

isGoingUp

public boolean isGoingUp()
Is this elevator going up?


pushButton

public void pushButton(Floor floor)

run

public void run()
This is the runner! It runs and runs and never gets tired.

Specified by:
run in interface java.lang.Runnable

getCurrentFloor

public Floor getCurrentFloor()
Get the floor that this elevator is currently at.


waitForFloor

public void waitForFloor(Floor f)
Wait for a specific floor to be reached.


notifyPassengersOfArrival

public void notifyPassengersOfArrival(Elevator.Landing l)

waitForNextFloor

public Floor waitForNextFloor()
Wait for any floor to be reached by the elevator.


start

public void start()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object