예제 #1
0
  public void popupActionPopupReleaseFinished() {
    if (actionStatus == ActionStatus.passGlass) {
      for (MyGlass g : glasses) {
        if (g.status == GlassStatus.WaitingForPass) {

          print("popup" + myIndex + "popup released the glass");
          glasses.remove(g);
          animationStatus = AnimationStatus.Nothing;
          actionStatus = ActionStatus.Nothing;
          nextCF.msgHereIsGlass(g.glass);
          return;
        }
      }
    } else if (actionStatus == ActionStatus.getGlassFromMachine) {
      for (MyGlass g : glasses) {
        if (g.status == GlassStatus.Ready) {
          print("popup" + myIndex + "popup released the glass");
          glasses.remove(g);
          animationStatus = AnimationStatus.Nothing;
          actionStatus = ActionStatus.Nothing;
          robots.get(g.robotIndex).status = RobotStatus.Empty;
          print("" + myIndex + "machine " + g.getRobotIndex() + " is set to empty!~~~~~");
          nextCF.msgHereIsGlass(g.glass);
          conveyor.msgPopupAvailable();
          return;
        }
      }
    }
  }
예제 #2
0
  public void deliverGlass(MyGlass g) {
    System.out.println("deliver the glass is called:" + myIndex + " " + g.getRobotIndex());
    g.status = GlassStatus.Delivering;
    Integer[] popupArgs = new Integer[1];
    popupArgs[0] = myIndex;
    Integer[] conveyorArgs = new Integer[1];
    conveyorArgs[0] = conveyor.getMyIndex();
    Integer[] robotArgs = new Integer[1];
    robotArgs[0] = g.robotIndex;
    // move down, take glass, take it to the next available machine
    transducer.fireEvent(TChannel.POPUP, TEvent.POPUP_DO_MOVE_DOWN, popupArgs);
    animationStatus = AnimationStatus.PopupMovingDown;
    //		try {
    //			animationSem.acquire();
    //		} catch (InterruptedException e) {
    //			e.printStackTrace();
    //		} // released by POPUP_GUI_MOVED_DOWN
    //		print("popup"+myIndex+" moved down the pop up");
    //		transducer.fireEvent(TChannel.CONVEYOR,TEvent.CONVEYOR_DO_START,conveyorArgs);
    //		try {
    //			animationSem.acquire();
    //		} catch (InterruptedException e) {
    //			e.printStackTrace();
    //		} // released by POPUP_GUI_LOAD_FINISHED
    //		print("popup"+myIndex+"popup finished loading");
    //		transducer.fireEvent(TChannel.POPUP,TEvent.POPUP_DO_MOVE_UP,popupArgs);

    //		print("popup"+myIndex+"popup moved up");
    //		transducer.fireEvent(myChannel, TEvent.WORKSTATION_DO_LOAD_GLASS,robotArgs);
    //		try {
    //			animationSem.acquire();
    //		} catch (InterruptedException e) {
    //			e.printStackTrace();
    //		} // released by WORKSTATION_LOAD_FINISHED
    //		//TODO
    //		print("workStation"+robotArgs[0]+"load glass finished");
    //		transducer.fireEvent(myChannel, TEvent.WORKSTATION_DO_ACTION,robotArgs);

    // robots.get(g.robotIndex).robot.msgHereIsGlass(g.glass);

    stateChanged();
  }