|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmodels.Elevator
public class Elevator
Field Summary | |
---|---|
int |
NUMBER_OF_FLOORS
|
Constructor Summary | |
---|---|
Elevator(int numberOfFloors)
|
Method Summary | |
---|---|
Direction |
currentDirection()
|
int |
currentFloor()
|
boolean |
downPressedAtFloor(int floor)
Permits elevator controller to see if a request to go down has been made at a specified floor |
boolean |
floorPressedInElevator(int floor)
Permits elevator controller to see if there is a request to a particular floor |
void |
installController(ControllerForElevator controller)
Update the lift controller component - intended to be done by an engineer |
boolean |
noMoreRequestsAbove(int floor)
|
boolean |
noMoreRequestsBelow(int floor)
|
void |
pressDown(int floor)
Permits elevator users to request elevator to take them down |
void |
pressFloorInElevator(int floor)
Permits elevator users inside the elevator to request elevator to take them to a particular floor |
void |
pressUp(int floor)
Permits elevator users to request elevator to take them up |
int |
topFloor()
|
java.lang.String |
toString()
|
boolean |
updateFloor()
move to next floor (as decided by the controller) |
boolean |
upPressedAtFloor(int floor)
Permits elevator controller to see if a request to go up has been made at a specified floor |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final int NUMBER_OF_FLOORS
Constructor Detail |
---|
public Elevator(int numberOfFloors) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
Method Detail |
---|
public Direction currentDirection()
currentDirection
in interface ElevatorForController
public int currentFloor()
currentFloor
in interface ElevatorForController
public boolean downPressedAtFloor(int floor) throws java.lang.IllegalArgumentException
ElevatorForController
downPressedAtFloor
in interface ElevatorForController
downPressedAtFloor
in interface ElevatorForUsers
floor
- specifies the floor at which the request is being checked
java.lang.IllegalArgumentException
- if the floor is not valid (from 1.. NUMBER_OF_FLOORS-1)public boolean floorPressedInElevator(int floor) throws java.lang.IllegalArgumentException
ElevatorForController
floorPressedInElevator
in interface ElevatorForController
floorPressedInElevator
in interface ElevatorForUsers
java.lang.IllegalArgumentException
- if the number of floors specified is not in rangepublic void installController(ControllerForElevator controller) throws java.lang.IllegalArgumentException
ElevatorSpecification
installController
in interface ElevatorSpecification
controller
- is the new controller module that will decide the logic of the elevator movement
java.lang.IllegalArgumentException
- if the controller is nullpublic boolean noMoreRequestsAbove(int floor) throws java.lang.IllegalArgumentException
noMoreRequestsAbove
in interface ElevatorForController
java.lang.IllegalArgumentException
- if the number of floors specified is not in rangepublic boolean noMoreRequestsBelow(int floor) throws java.lang.IllegalArgumentException
noMoreRequestsBelow
in interface ElevatorForController
java.lang.IllegalArgumentException
- if the number of floors specified is not in rangepublic void pressDown(int floor) throws java.lang.IllegalArgumentException
ElevatorForUsers
pressDown
in interface ElevatorForUsers
floor
- specifies the floor at which the down request is made
java.lang.IllegalArgumentException
- if the floor is not valid (from 1.. NUMBER_OF_FLOORS-1)public void pressFloorInElevator(int floor) throws java.lang.IllegalArgumentException
ElevatorForUsers
pressFloorInElevator
in interface ElevatorForUsers
java.lang.IllegalArgumentException
- if the number of floors specified is not in rangepublic void pressUp(int floor) throws java.lang.IllegalArgumentException
ElevatorForUsers
pressUp
in interface ElevatorForUsers
floor
- specifies the floor at which the up request is made
java.lang.IllegalArgumentException
- if the floor is not valid (from 0.. NUMBER_OF_FLOORS-2)public int topFloor()
topFloor
in interface ElevatorForController
public java.lang.String toString()
toString
in class java.lang.Object
public boolean updateFloor()
ElevatorSpecification
updateFloor
in interface ElevatorSpecification
public boolean upPressedAtFloor(int floor) throws java.lang.IllegalArgumentException
ElevatorForController
upPressedAtFloor
in interface ElevatorForController
upPressedAtFloor
in interface ElevatorForUsers
floor
- specifies the floor at which the request is being checked
java.lang.IllegalArgumentException
- if the floor is not valid (from 0.. NUMBER_OF_FLOORS-2)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |