|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmodels.StupidController
public class StupidController
The stupid controller ensures that the elevator moves from bottom to top to bottom ... stopping at every floor.
Constructor Summary | |
---|---|
StupidController(ElevatorForController elevator)
|
Method Summary | |
---|---|
void |
bindToElevator(ElevatorForController elevator)
Ensure that the controller is controlling only a single elevator |
Direction |
calculateDirection()
If the elevator is on the top floor then set the direction to down If the elevator is on the bottom floor then set the direction to up If the elevator is moving up then keep moving up until it reaches the top floor If the elevator is moving down then keep moving down until it reaches the top floor If the elevator is not moving then start it moving down towards the bottom floor |
boolean |
stopAtNextFloor()
Always stop at the next floor |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public StupidController(ElevatorForController elevator) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
Method Detail |
---|
public void bindToElevator(ElevatorForController elevator) throws java.lang.IllegalArgumentException
ControllerForElevator
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()
calculateDirection
in interface ControllerForElevator
public boolean 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 |