MyContractNetResponder.java

[java]
/**
* Section 5.4.2 page 103
*
**/
import jade.proto.*;
import jade.lang.acl.*;
import jade.core.Agent;

public class MyContractNetResponder extends ContractNetResponder {

public MyContractNetResponder(Agent a,MessageTemplate mt) {
super(a, mt);
}

protected ACLMessage handleCfp(ACLMessage cfp) {
ACLMessage reply = cfp.createReply();
// Evaluate the call
if (true) { //if (call OK) {
// Prepare a proposal
reply.setPerformative(ACLMessage.PROPOSE);
}
else {
reply.setPerformative(ACLMessage.REFUSE);
}
return reply;
}
}
[/java]