edu.lmu.liftor
Class Elevator.Landing

java.lang.Object
  |
  +--edu.lmu.liftor.Elevator.Landing
Enclosing class:
Elevator

public static class Elevator.Landing
extends java.lang.Object

A part of a floor that an Elevator may interact with.


Field Summary
 Floor floor
          The floor that this landing is on.
 
Constructor Summary
Elevator.Landing(Floor f)
          Construct a new landing on the given floor.
 
Method Summary
 void addElevator(Elevator e)
          Add an elevator to this landing.
 boolean boardElevator(Elevator e, Person v)
          Attempt to board the elevator.
 void elevatorClose(Elevator e)
          The given elevator is trying to revoke boarding on this landing.
 void elevatorOpen(Elevator e)
          The given elevator is offering boarding on this landing.
 int getDownWaiters()
           
 Floor getFloor()
           
 int getUpWaiters()
           
 boolean leaveElevator(Elevator e, Person v)
          Attempt to leave the elevator.
 void notifyPassengersOfArrival(Elevator e)
          The given elevator has arrived at this landing.
 java.lang.String toString()
           
 Elevator waitForDownElevator()
          Wait, indefinitely, for a down elevator to arrive at this floor.
 Elevator waitForUpElevator()
          Wait, indefinitely, for an up elevator to arrive at this floor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

floor

public final Floor floor
The floor that this landing is on.

Constructor Detail

Elevator.Landing

public Elevator.Landing(Floor f)
Construct a new landing on the given floor.

Method Detail

getFloor

public Floor getFloor()

notifyPassengersOfArrival

public void notifyPassengersOfArrival(Elevator e)
The given elevator has arrived at this landing.


waitForDownElevator

public Elevator waitForDownElevator()
Wait, indefinitely, for a down elevator to arrive at this floor.


waitForUpElevator

public Elevator waitForUpElevator()
Wait, indefinitely, for an up elevator to arrive at this floor.


getUpWaiters

public int getUpWaiters()

getDownWaiters

public int getDownWaiters()

leaveElevator

public boolean leaveElevator(Elevator e,
                             Person v)
Attempt to leave the elevator. Returns true if the elevator was successfully boarded.


boardElevator

public boolean boardElevator(Elevator e,
                             Person v)
Attempt to board the elevator. Returns true if the elevator was successfully boarded.


elevatorOpen

public void elevatorOpen(Elevator e)
The given elevator is offering boarding on this landing.


elevatorClose

public void elevatorClose(Elevator e)
The given elevator is trying to revoke boarding on this landing. This method returns once an elevators doors have closed. I.e. the elevator may travel freely.


addElevator

public void addElevator(Elevator e)
Add an elevator to this landing.


toString

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