Professional Documents
Culture Documents
Libros Unive
Libros Unive
Libros Unive
Taller 2
Código :
/*
*/
package jade;
import jade.core.Agent;
import jade.core.behaviours.Behaviour;
import jade.core.behaviours.CyclicBehaviour;
import jade.core.behaviours.OneShotBehaviour;
import java.util.Scanner;
public class HelloJade extends Agent {
addBehaviour(new CyclicBehaviour(this) {
System.out.println("Cycling");
});
addBehaviour(new FourStepBehaviour());
switch (step) {
case 1:
System.out.println("Operation 1");
int a=n.nextInt();
System.out.println();
break;
case 2:
System.out.println(
myAgent.addBehaviour(new OneShotBehaviour(myAgent) {
System.out.println("One-shot");
});
break;
case 3:
System.out.println("Operation 3");
break;
case 4:
System.out.println("Operation 4");
break;
step++;
return step == 5;
myAgent.doDelete();
return super.onEnd();
}