m865.simulation
Class MoveOnEvent
java.lang.Object
m865.simulation.Event
m865.simulation.DepartmentStoreEvent
m865.simulation.MoveOnEvent
- All Implemented Interfaces:
- java.lang.Comparable, Prioritizeable
public class MoveOnEvent
- extends DepartmentStoreEvent
MoveOnEvent decides if the elevator should move up a floor, down a floor,
or stay on the current floor.
Nested Class Summary |
static class |
MoveOnEvent.State
The three states which represent how the elevator can move |
Method Summary |
void |
fire()
Decides how the elevator should move after all the passengers get
off and get on. |
java.lang.String |
toString()
The toString method |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
elevator
protected Elevator elevator
- Field to store which elevator we are working with
currentMove
protected MoveOnEvent.State currentMove
- The state of the way we want the elevator to move
MoveOnEvent
public MoveOnEvent(java.lang.Integer time,
DepartmentStore ds,
Elevator elev)
- Constructor for objects of class MoveOnEvent
fire
public void fire()
- Decides how the elevator should move after all the passengers get
off and get on.
- The elevator was moving up
- There is a buttonPress above, keep moving up
- There is a button Press below, start moving down
- There is no buttonPress, we begin to head to the first floor to
wait for a button press
- The elevator was moving down
- There is a buttonPress below, keep moving down
- There is a button Press above, start moving up
- There is no buttonPress, we move down to the first floor and wait
- Specified by:
fire
in class Event
toString
public java.lang.String toString()
- The toString method
- Overrides:
toString
in class Event
- Returns:
- a string to identify this type of event