[java]
/**
* Section 4.2.2, Page 60
*
* Generic behaviours embed a status trigger and execute different operations depending
* on the status value. They complete when a given condition is met.
**/
import jade.core.behaviours.Behaviour;
public class ThreeStepBehaviour extends Behaviour {
private int step = 0;
public void action() {
switch (step) {
case 0:
// perform operation X
step++;
break;
case 1:
// perform operation Y
step++;
break;
case 2:
// perform operation Z
step++;
break;
}
}
public boolean done() {
return step == 3;
}
}
[/java]