Пример #1
0
 /** Called when the drive is transitioning to the Stop state */
 private void driveStopping() {
   int currentFloor = floorArray.getCurrentFloor();
   Hallway h;
   if (Elevator.hasLanding(currentFloor, Hallway.FRONT)) {
     if (Elevator.hasLanding(currentFloor, Hallway.BACK)) h = Hallway.BOTH;
     else h = Hallway.FRONT;
   } else h = Hallway.BACK;
   currentFloor--;
   if (h == Hallway.BOTH) {
     if (!carLights[currentFloor][Hallway.FRONT.ordinal()].lighted()
         && !carLights[currentFloor][Hallway.BACK.ordinal()].lighted()
         && !hallLights[currentFloor][Hallway.FRONT.ordinal()][Direction.UP.ordinal()].lighted()
         && !hallLights[currentFloor][Hallway.FRONT.ordinal()][Direction.DOWN.ordinal()].lighted()
         && !hallLights[currentFloor][Hallway.BACK.ordinal()][Direction.UP.ordinal()].lighted()
         && !hallLights[currentFloor][Hallway.BACK.ordinal()][Direction.DOWN.ordinal()]
             .lighted()) {
       warning("R-T6 Violated: Stopped at floor" + currentFloor + " with no pending calls.");
     }
   } else if (!carLights[currentFloor][h.ordinal()].lighted()
       && !hallLights[currentFloor][h.ordinal()][Direction.UP.ordinal()].lighted()
       && !hallLights[currentFloor][h.ordinal()][Direction.DOWN.ordinal()].lighted()) {
     warning("R-T6 Violated: Stopped at floor" + currentFloor + " with no pending calls.");
   }
 }
Пример #2
0
 public DoorStateMachine() {
   state[Hallway.FRONT.ordinal()] = DoorState.CLOSED;
   state[Hallway.BACK.ordinal()] = DoorState.CLOSED;
 }