|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmodels.EmergencyController
public class EmergencyController
The behaviour of an elevator when there is an emergency to be managed:
the elevator must always stay at the current floor and stop at the next floor if already moving.
Tested by JUnit_EmergencyController
Constructor Summary | |
---|---|
EmergencyController()
|
Method Summary | |
---|---|
void |
bindToElevator(ElevatorForController elevator)
In this emergency controller we do not need to read the state of the elevator and so we do not need to bind the 2 components together. |
Direction |
calculateDirection()
In an emergency situation the controller must always stay at the current floor Tested by JUnit_EmergencyController.test_calculateDirection() |
boolean |
stopAtNextFloor()
In an emergency situation the controller must stop at the next floor Tested by JUnit_EmergencyController.test_stopAtNextFloor() |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public EmergencyController()
Method Detail |
---|
public void bindToElevator(ElevatorForController elevator) throws java.lang.IllegalArgumentException
bindToElevator
in interface ControllerForElevator
elevator
- is the unique elevator to which the controller is now connected
java.lang.IllegalArgumentException
- if the elevator being connected is nullpublic Direction calculateDirection()
JUnit_EmergencyController.test_calculateDirection()
calculateDirection
in interface ControllerForElevator
public boolean stopAtNextFloor()
JUnit_EmergencyController.test_stopAtNextFloor()
stopAtNextFloor
in interface ControllerForElevator
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |