es.upv.dsic.gti_ia.cAgents.protocols
Class FIPA_CONTRACTNET_Initiator

java.lang.Object
  extended by es.upv.dsic.gti_ia.cAgents.protocols.FIPA_CONTRACTNET_Initiator

public abstract class FIPA_CONTRACTNET_Initiator
extends Object

Template for CFactories that manage fipa contract net initiator conversation. The user has to create his/her own class extending from this one. And implement the abstract methods. Other methods can be overriden in order to modify the default behaviour

Author:
ricard

Constructor Summary
FIPA_CONTRACTNET_Initiator()
           
 
Method Summary
protected  void doBegin(CProcessor myProcessor, ACLMessage msg)
          Method executed at the beginning of the conversation
protected abstract  void doEvaluateProposals(CProcessor myProcessor, ArrayList<ACLMessage> proposes, ArrayList<ACLMessage> acceptances, ArrayList<ACLMessage> rejections)
          Evaluate proposals.
protected  void doFinal(CProcessor myProcessor, ACLMessage messageToSend)
          Method executed when the initiator ends the conversation
protected  void doReceiveFailure(CProcessor myProcessor, ACLMessage msg)
          Method executed when the initiator receives a failure
protected abstract  void doReceiveInform(CProcessor myProcessor, ACLMessage msg)
          Method executed when the initiator receives a inform
protected  void doReceiveNotUnderstood(CProcessor myProcessor, ACLMessage msg)
          Method executed when the initiator receives a not-understood message
protected  void doReceiveProposal(CProcessor myProcessor, ACLMessage msg)
          Method executed when the initiator receives a proposal
protected  void doReceiveRefuse(CProcessor myProcessor, ACLMessage msg)
          Method executed when the initiator receives a refuse message
protected  void doSolicitProposals(CProcessor myProcessor, ACLMessage messageToSend)
          Method executed when the initiator calls for proposals
protected  void doTimeout(CProcessor myProcessor, ACLMessage msg)
          Method executed when the timeout is reached while the initiator was waiting for proposals
 CFactory newFactory(String name, MessageFilter filter, ACLMessage template, int availableConversations, CAgent myAgent, int participants, long deadline, int timeout)
          Creates a new contract net initiator factory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FIPA_CONTRACTNET_Initiator

public FIPA_CONTRACTNET_Initiator()
Method Detail

doBegin

protected void doBegin(CProcessor myProcessor,
                       ACLMessage msg)
Method executed at the beginning of the conversation

Parameters:
myProcessor - the CProcessor managing the conversation
msg - first message to send in the conversation

doSolicitProposals

protected void doSolicitProposals(CProcessor myProcessor,
                                  ACLMessage messageToSend)
Method executed when the initiator calls for proposals

Parameters:
myProcessor - the CProcessor managing the conversation
messageToSend - Message to send

doReceiveNotUnderstood

protected void doReceiveNotUnderstood(CProcessor myProcessor,
                                      ACLMessage msg)
Method executed when the initiator receives a not-understood message

Parameters:
myProcessor - the CProcessor managing the conversation
msg - not-understood message

doReceiveRefuse

protected void doReceiveRefuse(CProcessor myProcessor,
                               ACLMessage msg)
Method executed when the initiator receives a refuse message

Parameters:
myProcessor - the CProcessor managing the conversation
msg - refuse message

doReceiveProposal

protected void doReceiveProposal(CProcessor myProcessor,
                                 ACLMessage msg)
Method executed when the initiator receives a proposal

Parameters:
myProcessor - the CProcessor managing the conversation
msg - proposal message

doTimeout

protected void doTimeout(CProcessor myProcessor,
                         ACLMessage msg)
Method executed when the timeout is reached while the initiator was waiting for proposals

Parameters:
myProcessor - the CProcessor managing the conversation
msg - timeout message

doEvaluateProposals

protected abstract void doEvaluateProposals(CProcessor myProcessor,
                                            ArrayList<ACLMessage> proposes,
                                            ArrayList<ACLMessage> acceptances,
                                            ArrayList<ACLMessage> rejections)
Evaluate proposals. Each accepted proposal has to be added to the acceptances list. Each rejected proposal has to be added to the rejected list

Parameters:
myProcessor - the CProcessor managing the conversation
proposes - Proposals
acceptances - Accepted proposals
rejections - Rejected proposals

doReceiveFailure

protected void doReceiveFailure(CProcessor myProcessor,
                                ACLMessage msg)
Method executed when the initiator receives a failure

Parameters:
myProcessor - the CProcessor managing the conversation
msg - the failure message

doReceiveInform

protected abstract void doReceiveInform(CProcessor myProcessor,
                                        ACLMessage msg)
Method executed when the initiator receives a inform

Parameters:
myProcessor - the CProcessor managing the conversation
msg - inform message

doFinal

protected void doFinal(CProcessor myProcessor,
                       ACLMessage messageToSend)
Method executed when the initiator ends the conversation

Parameters:
myProcessor - the CProcessor managing the conversation
messageToSend - final message of this conversation

newFactory

public CFactory newFactory(String name,
                           MessageFilter filter,
                           ACLMessage template,
                           int availableConversations,
                           CAgent myAgent,
                           int participants,
                           long deadline,
                           int timeout)
Creates a new contract net initiator factory

Parameters:
name - of the factory
filter - message filter
template - first message to send
availableConversations - maximum number of conversation this CFactory can manage simultaneously
myAgent - agent owner of this Cfactory
participants - number of participants
deadline - for waiting for proposals
timeout - for waiting for inform
Returns:
the a new contract net initiator CFactory


Copyright © 2012 GTI-IA. All Rights Reserved.