m865.simulation
Class MoveOnEvent

java.lang.Object
  extended by m865.simulation.Event
      extended by m865.simulation.DepartmentStoreEvent
          extended by 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
 
Field Summary
protected  MoveOnEvent.State currentMove
          The state of the way we want the elevator to move
protected  Elevator elevator
          Field to store which elevator we are working with
 
Fields inherited from class m865.simulation.DepartmentStoreEvent
departmentStore
 
Fields inherited from class m865.simulation.Event
firingTime
 
Constructor Summary
MoveOnEvent(java.lang.Integer time, DepartmentStore ds, Elevator elev)
          Constructor for objects of class MoveOnEvent
 
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 m865.simulation.Event
adjustPriority, compareTo, getFiringTime, setFiringTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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

Constructor Detail

MoveOnEvent

public MoveOnEvent(java.lang.Integer time,
                   DepartmentStore ds,
                   Elevator elev)
Constructor for objects of class MoveOnEvent

Method Detail

fire

public void fire()
Decides how the elevator should move after all the passengers get off and get on.
  1. 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
  2. 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
  3. 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