|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--cscie160.hw2.Elevator
Field Summary | |
static int |
CAPACITY
|
static int |
NUM_FLOORS
|
Constructor Summary | |
Elevator()
|
Method Summary | |
void |
boardPassenger(int mDestinationFloor)
Board a passenger destined for a floor. |
int |
findDirection()
Return the direction of closest destination floor, with preference for moving down. |
int |
getNumPassengersDestForFloor(int mFloor)
Return the # of passengers destined for floor [mFloor]. |
void |
go()
Drive elevator to next destination. |
boolean |
isElevatorFull()
Return 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 |
registerRequest(int mFloorNum,
boolean mCreateThatPerson)
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. |
void |
stop()
Stop the elevator and unload pPassengers destined for this floor. |
java.lang.String |
toString()
Override the toString() method of java.lang.Object for printing Elevator values. |
void |
unloadPassenger()
Unload a passenger. |
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(int mDestinationFloor) throws ElevatorFullException
mDestinationFloor
- The floor that passenger wants to go to.
ElevatorFullException
public void unloadPassenger()
public void stop()
public void registerRequest(int mFloorNum, boolean mCreateThatPerson)
mCreateThatPerson
- If true put a person on that floor waiting.public int findDirection()
public void go()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isElevatorFull()
public int getNumPassengersDestForFloor(int mFloor)
mFloor
- Floor number being checked for.
public void setFloorRequests(int mFloor, int mNewValue)
mFloor
- Floor number being checked for.mNewValue
- Floor number being checked for.public static void main(java.lang.String[] mArgv)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |