Inherits from Object
A class that represents an elevator member of an ElevatorBank.
bank | A reference to the ElevatorBank associated with this elevator. |
capacity | The total capacity. This value is entered by the user in the elevator bank properties. |
isGoingDown | A boolean telling if the elevator is currently going down. |
isGoingUp | A boolean telling if the elevator is currently going up. |
lastFloorZ | The z location of the floor that the elevator most recently stopped at. |
nextFloorZ | The z location of the floor that the elevator was most recently dispatched to. |
travelDirection | An integer signifying the elevator's current travel direction. 1 means going up, -1 means going down. 0 means the elevator is idle. |
usedCapacity | The currently used capacity, i.e. the sum of the capacity usages of each traveler currently on the elevator. |
canStop | Returns true if the elevator can stop at the target z location and desired travel direction, given the elevator's current location and travel direction. |
moveToFloor | Tells the elevator to move to the target floor. |
readonly ElevatorBank bank
A reference to the ElevatorBank associated with this elevator.
readonly double capacity
The total capacity. This value is entered by the user in the elevator bank properties.
readonly int isGoingDown
A boolean telling if the elevator is currently going down.
readonly int isGoingUp
A boolean telling if the elevator is currently going up.
readonly double lastFloorZ
The z location of the floor that the elevator most recently stopped at.
readonly double nextFloorZ
The z location of the floor that the elevator was most recently dispatched to.
readonly int travelDirection
An integer signifying the elevator's current travel direction. 1 means going up, -1 means going down. 0 means the elevator is idle.
readonly double usedCapacity
The currently used capacity, i.e. the sum of the capacity usages of each traveler currently on the elevator.
int canStop( double floorZ , int travelDirection ) |
floorZ | The desired z location to stop at. |
travelDirection | The desired travel direction for a request. 1 means going up, -1 means going down, 0 means to ignore desired travel direction. |
int | 1 if the elevator can stop at the location, 0 otherwise. |
Returns true if the elevator can stop at the target z location and desired travel direction, given the elevator's current location and travel direction.
This method uses several factors to determine whether the elevator can stop at a given location, as follows:
void moveToFloor( double floorZ ) |
floorZ | The desired z location to move to. |
void | True if the elevator can stop at the location. |
Tells the elevator to move to the target floor.
Since the elevator implements automatic logic for moving between floors, generally you will only use this method in the following situations.