|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--cscie160.hw3.Elevator
Field Summary | |
static int |
CAPACITY
|
static int |
NUM_FLOORS
|
Constructor Summary | |
Elevator()
|
Method Summary | |
void |
boardPassenger(cscie160.hw3.Passenger objPerson)
Board a passenger destined for a floor. |
boolean |
clearedRequests()
Check if all elevator requests have been satisfied If so, true is returned, indicating that all passengers have arrived at their destinations, so thee elevator has finished its work and may stop. |
void |
findDirection()
Sets the direction of movement floorRequests and the destinations passengers waiting on a floor are checked to determine if the elevator should go up or down. |
int |
getTravelDirection()
used by unloadAndLoadPassengers() in class Floor to find the direction of travel of the elevator, and thus determine what passengers should alight the Elevator. |
void |
go()
Drive elevator to next destination. |
boolean |
isElevatorFull()
Returns true if elevator is at capacity. |
static void |
main(java.lang.String[] mArgv)
Create an elevator and board two pPassengers into it. |
void |
move()
Move elevator one floor in the pTravelDirection. |
void |
newPerson(int mOnFloor,
int mDestFloor)
Tell class Floor to create a Person object waiting on floor [mFloor] and wanting to go to Floor [mDestFloor] |
void |
registerRequest(int mFloorNum)
Register a request for floor [mFloor]. |
void |
setFloorRequests(int mFloor,
int mNewValue)
Needed by loadPassengers() in class Floor to set the floor requests for floor [mFloor] = the number of passengers still on that floor waiting for the elevator [mNewValue] when elevator is full. |
java.lang.String |
toString()
Override the toString() method of java.lang.Object for printing Elevator values. |
void |
unloadPassengers()
Unload all passengers destined for this floor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int CAPACITY
public static final int NUM_FLOORS
Constructor Detail |
public Elevator()
Method Detail |
public void move()
public void boardPassenger(cscie160.hw3.Passenger objPerson) throws ElevatorFullException
objPerson
- reference to the Passenger object boarding the elevator.
ElevatorFullException
public void unloadPassengers()
public void findDirection()
public boolean clearedRequests()
public void go()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isElevatorFull()
public void setFloorRequests(int mFloor, int mNewValue)
mFloor
- Floor number being checked for.mNewValue
- Floor number being checked for.public int getTravelDirection()
public void registerRequest(int mFloorNum)
public void newPerson(int mOnFloor, int mDestFloor)
mOnFloor
- Floor new person is on.mDestFloor
- Floor person wants to go to.public static void main(java.lang.String[] mArgv)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |