|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--cscie160.hw2.Floor
CSCIE160
Assignment 2: Elevator part 2
Floor class: This class complements the elevator class for the elevator project.
By David Cheung
Field Summary | |
int |
floorIdentifier
This is the floor number of the floor. |
Constructor Summary | |
Floor(int i)
Floor constructor: |
Method Summary | |
void |
loadPassengers(Elevator myElevator,
int numOfPeople)
loadPassengers This is not called by the elevator, but used as test method to load in passengers. |
java.lang.String |
toString()
toString |
void |
unloadPassengers(Elevator anElevator)
unloadPassengers: |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public int floorIdentifier
This is used for debugging purposes only.
Constructor Detail |
public Floor(int i)
sets floorIdentifier.
i
- The floor number of the floor.Method Detail |
public void unloadPassengers(Elevator anElevator)
This Method consists of 2 parts:
The first part is from hw1's stop(). The second part is the new implemented exception feature.
After unloading people in the elevator, this function attempts to board passengers to the elevator if sucessful, then method completes. If elevator happens to be full, then this method will cause Elevator's boardPassenger function to throw an exception. Thus the remaining passengers will be left on the floor.
If the exception was thrown, then a registerRequest to the elevator will be initiated. (Done in Catch)
public void loadPassengers(Elevator myElevator, int numOfPeople)
public java.lang.String toString()
For debugging use. Returns the numOfPassengers for this floor
toString
in class java.lang.Object
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |