Beispiel #1
0
 public void msgHereIsGlass(Glass g) // 8 from conveyor
     {
   MyGlass newGlass = new MyGlass(g);
   newGlass.status = GlassStatus.Pending;
   glasses.add(newGlass);
   stateChanged();
 }
Beispiel #2
0
  public void msgGlassReady(
      Integer thisIndex) // 10a from machine, moveup to take the glass if 10b is received labter
      {
    for (MyGlass myGlass : glasses) {
      if (myGlass.status == GlassStatus.Handling && myGlass.robotIndex.equals(thisIndex)) {

        myGlass.status = GlassStatus.Ready;
        break;
      }
    }
    stateChanged();
  }
Beispiel #3
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();
  }
Beispiel #4
0
 public void popupActionWorkStationLoadFinished() {
   if (actionStatus == ActionStatus.deliverGlass) // done with deliverGlass
   {
     synchronized (glasses) {
       for (MyGlass g : glasses) {
         if (g.status == GlassStatus.Delivering) {
           Integer[] robotArgs = new Integer[1];
           robotArgs[0] = g.robotIndex;
           transducer.fireEvent(myChannel, TEvent.WORKSTATION_DO_ACTION, robotArgs);
           robots.get(g.robotIndex).startTime = System.currentTimeMillis();
           g.status = GlassStatus.Handling;
           animationStatus = AnimationStatus.Nothing;
           actionStatus = ActionStatus.Nothing;
           stateChanged();
           break;
         }
       }
     }
   }
 }
Beispiel #5
0
 public void msgComeDownAndLetGlassPass(Glass g) {
   MyGlass newGlass = new MyGlass(g);
   newGlass.status = GlassStatus.WaitingForPass;
   glasses.add(newGlass);
   stateChanged();
 }