/** * Section 5.2.1, Page 92 * * This is the ThreeStepBehaviour class presented in Section 4.2.2 * reimplemented by using the SequentialBehaviour class. **/ import jade.core.behaviours.*; import jade.core.Agent; public class ThreeStepBehaviourAgent extends Agent { public void setup() { SequentialBehaviour threeStepBehaviour = new SequentialBehaviour(this); threeStepBehaviour.addSubBehaviour(new OneShotBehaviour(this) { public void action() { // perform operation X System.out.println("operation X "); } } ); threeStepBehaviour.addSubBehaviour(new OneShotBehaviour(this) { public void action() { // perform operation Y System.out.println("operation Y "); } } ); threeStepBehaviour.addSubBehaviour(new OneShotBehaviour(this) { public void action() { // perform operation Z System.out.println("operation Z "); } } ); addBehaviour(threeStepBehaviour); } }