private void OrderIsReady(Order o) { print("OrderIsReady() called: " + o.order + " ready for table #: " + o.tableNum); DoGoToCookingArea(); try { atDestination.acquire(); } catch (InterruptedException e) { e.printStackTrace(); } o.state = OrderState.GoingToPlating; cookGui.DoDisplayOrder(o.order + "(d)"); cookGui.DoDisplayCookingOrders(getCookingOrders()); DoGoToPlatingArea(); try { atDestination.acquire(); } catch (InterruptedException e) { e.printStackTrace(); } cookGui.DoDisplayOrder(""); WaiterAgent w = o.waiter; w.msgOrderReady(o.tableNum, o.order); orders.remove(o); }
private void PrepareOrder(Order o) { print("PrepareOrder() called"); DoGoToFridge(); try { atDestination.acquire(); } catch (InterruptedException e) { e.printStackTrace(); } cookGui.DoDisplayOrder(o.order + "(nd)"); DoGoToCookingArea(); try { atDestination.acquire(); } catch (InterruptedException e) { e.printStackTrace(); } o.state = OrderState.Cooking; cookGui.DoDisplayOrder(""); cookGui.DoDisplayCookingOrders(getCookingOrders()); final Order theOrder = o; long currentTime = System.currentTimeMillis(); // sets a timer that will notify when order is done cooking timer.schedule( new TimerTask() { public void run() { print("Finished order"); msgOrderDone(theOrder); stateChanged(); } }, Math.max(o.finishTime - currentTime, 1)); // how long to wait before running task DoGoToPlatingArea(); try { atDestination.acquire(); } catch (InterruptedException e) { e.printStackTrace(); } }
private void DoGoToCookingArea() { print("Going to cooking area"); cookGui.DoGoToCookingArea(); }
private void DoGoToFridge() { print("Going to fridge"); cookGui.DoGoToFridge(); }
private void DoGoToPlatingArea() { print("Going to plating area"); cookGui.DoGoToPlatingArea(); }
public void msgShiftDone(double w) { shiftDone = true; isWorking = false; wage = w; cookGui.DoLeave(person, wage); }