Skip to content

Instantly share code, notes, and snippets.

@jesjos
Created February 20, 2011 23:50
Show Gist options
  • Save jesjos/836432 to your computer and use it in GitHub Desktop.
Save jesjos/836432 to your computer and use it in GitHub Desktop.
process mainLoop {
MyTime t;
while (numberOfDrinks < Constants.MAX_DRINKS) {
t = new MyTime(clock.getTime().getValue());
drink = orderQueue(myOrder, t);
if (drink instanceof Landlord.Refusal) {
System.out.println("Customer says: I was refused!!!! I'll return later with an AK-47 and blast the place.");
break;
}
numberOfDrinks++;
// Go to table
// Drink
// Clean out surplus alarms
while (alarm.length() > 0)
receive alarm();
//
send clock.setAlarm(alarm, Constants.DRINK_TIME);
inni void alarm() {
}
[] void lastCall() st (myOrder == Constants.Order.BEER) {
numberOfDrinks = 4;
System.out.println("I received a last call message.");
}
// Place drink on table
if (drink instanceof ServingArea.Cup) {
call putCup((ServingArea.Cup) drink);
} else {
call putGlass((ServingArea.Glass) drink);
}
drink = null;
}
System.out.println("Customer going home.");
send handShake(this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment