|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectm865.simulation.Elevator
public class Elevator
The Elevator class.
Nested Class Summary | |
---|---|
static class |
Elevator.State
The three states of an elevator relative to its motion. |
Field Summary | |
---|---|
protected int |
capacity
Elevator capacity |
protected Elevator.State |
currentDirection
The state of the elevator's motion |
protected int |
currentFloor
The floor the elevator is at |
protected int[] |
passengerFloor
Array of Floors corresponding to the passengers inside the elevator |
protected java.util.ArrayList<Passenger> |
passengers
ArrayList of Passengers inside the elevator |
Constructor Summary | |
---|---|
Elevator(int capacity,
int nf)
Constructor for the Elevator class |
Method Summary | |
---|---|
boolean |
anyPassengers()
Any passengers for the current floor? |
int |
getCapacity()
Get the elevator's capacity |
Elevator.State |
getCurrentDirection()
Get current elevator's direction |
int |
getCurrentFloor()
Get current elevator's floor |
int |
getNumberOfPassengers()
Number of passengers inside the elevator |
void |
loadPassenger(Passenger p)
Load Passenger LoadEvent will send the passenger and the corresponding floor to the elevator |
void |
setDirection(Elevator.State dir)
update elevator direction MoveOnEvent will send this information to elevator |
void |
setFloor(int floor)
update current floor ElevatorArrivalEvent will send this information to elevator |
Passenger |
unloadPassenger()
Unload Passenger OffLoadEvent will request a passenger for this floor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Elevator.State currentDirection
protected int currentFloor
protected int capacity
protected java.util.ArrayList<Passenger> passengers
protected int[] passengerFloor
Constructor Detail |
---|
public Elevator(int capacity, int nf)
capacity
- The maximum number of passengers the elevator can holdnf
- The number of floors the elevator can visit.Method Detail |
---|
public int getCapacity()
public void setDirection(Elevator.State dir)
public Elevator.State getCurrentDirection()
public void setFloor(int floor)
public int getCurrentFloor()
public int getNumberOfPassengers()
public void loadPassenger(Passenger p)
public boolean anyPassengers()
public Passenger unloadPassenger()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |