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

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

public abstract class FIPA_CONTRACTNET_Participant
extends Object

Template for CFactories that manage fipa contract net participant 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_Participant()
           
 
Method Summary
protected  void doBegin(CProcessor myProcessor, ACLMessage msg)
          Method executed at the beginning of the conversation
protected  void doFinal(CProcessor myProcessor, ACLMessage messageToSend)
          Method executed when the conversation ends
protected  void doReceiveAccept(CProcessor myProcessor, ACLMessage msg)
          Method executed when the initiator accepts participant's proposal
protected  void doReceiveReject(CProcessor myProcessor, ACLMessage msg)
          Method executed when the initiator rejects participant's proposal
protected abstract  String doReceiveSolicit(CProcessor myProcessor, ACLMessage msg)
          Method executed when the participant receives a call for proposals
protected  void doSendFailure(CProcessor myProcessor, ACLMessage messageToSend)
          Method executed when the task failed
protected abstract  void doSendInfo(CProcessor myProcessor, ACLMessage messageToSend)
          Method executed when the task succeeded
protected  void doSendNotUnderstood(CProcessor myProcessor, ACLMessage messageToSend)
          Method executed when the participant sends a not-understood
protected abstract  void doSendProposal(CProcessor myProcessor, ACLMessage messageToSend)
          Method executed when the participant sends a proposal
protected  void doSendRefuse(CProcessor myProcessor, ACLMessage messageToSend)
          Method executed when the participant sends a refuse
protected abstract  String doTask(CProcessor myProcessor, ACLMessage solicitMessage)
          Perform the proposal's task
 CFactory newFactory(String name, MessageFilter filter, ACLMessage template, int availableConversations, CAgent myAgent, int timeout)
          Creates a new contract-net participant CFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FIPA_CONTRACTNET_Participant

public FIPA_CONTRACTNET_Participant()
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 assigned to this conversation

doReceiveSolicit

protected abstract String doReceiveSolicit(CProcessor myProcessor,
                                           ACLMessage msg)
Method executed when the participant receives a call for proposals

Parameters:
myProcessor - the CProcessor managing the conversation
msg - call for proposals message
Returns:
next state of this conversation

doSendProposal

protected abstract void doSendProposal(CProcessor myProcessor,
                                       ACLMessage messageToSend)
Method executed when the participant sends a proposal

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

doSendRefuse

protected void doSendRefuse(CProcessor myProcessor,
                            ACLMessage messageToSend)
Method executed when the participant sends a refuse

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

doSendNotUnderstood

protected void doSendNotUnderstood(CProcessor myProcessor,
                                   ACLMessage messageToSend)
Method executed when the participant sends a not-understood

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

doReceiveAccept

protected void doReceiveAccept(CProcessor myProcessor,
                               ACLMessage msg)
Method executed when the initiator accepts participant's proposal

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

doReceiveReject

protected void doReceiveReject(CProcessor myProcessor,
                               ACLMessage msg)
Method executed when the initiator rejects participant's proposal

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

doTask

protected abstract String doTask(CProcessor myProcessor,
                                 ACLMessage solicitMessage)
Perform the proposal's task

Parameters:
myProcessor - the CProcessor managing the conversation
solicitMessage - the first message assigned to this conversation containing the solicit of the initiator agent
Returns:
next conversation state

doSendFailure

protected void doSendFailure(CProcessor myProcessor,
                             ACLMessage messageToSend)
Method executed when the task failed

Parameters:
myProcessor - the CProcessor managing the conversation
messageToSend - fail message

doSendInfo

protected abstract void doSendInfo(CProcessor myProcessor,
                                   ACLMessage messageToSend)
Method executed when the task succeeded

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

doFinal

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

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

newFactory

public CFactory newFactory(String name,
                           MessageFilter filter,
                           ACLMessage template,
                           int availableConversations,
                           CAgent myAgent,
                           int timeout)
Creates a new contract-net participant CFactory

Parameters:
name - factory's name
filter - message filter
template - first message to send
availableConversations - maximum number of conversation this CFactory can manage simultaneously
myAgent - agent owner of this CFactory
timeout - for waiting after sending the proposal
Returns:
a new fipa contract net participant factory


Copyright © 2012 GTI-IA. All Rights Reserved.