es.upv.dsic.gti_ia.architecture
Class FIPAContractNetInitiator

java.lang.Object
  extended by es.upv.dsic.gti_ia.architecture.FIPAContractNetInitiator

public class FIPAContractNetInitiator
extends Object

This class implements the FIPA-Contract-Net interaction protocol, Role Initiator

Version:
2009.9.07
Author:
Joan Bellver Faus, GTI-IA, DSIC, UPV

Field Summary
 QueueAgent myAgent
           
 
Constructor Summary
FIPAContractNetInitiator(QueueAgent agent, ACLMessage msg)
          Creates a new FIPA-Contract-Net interaction protocol, initiator role.
 
Method Summary
 void action()
          Runs the state machine with the communication protocol
protected  void handleAllResponses(ArrayList<ACLMessage> responses, ArrayList<ACLMessage> accepted)
          This method is called when all the responses have been collected or when the timeout is expired
protected  void handleFailure(ACLMessage msg)
          This method is called when a failure message is received.
protected  void handleInform(ACLMessage msg)
          This method is called when a inform message is received.
protected  void handleNotUnderstood(ACLMessage msg)
          This method is called when a NotUnderstood message is received.
protected  void handleOutOfSequence(ACLMessage msg)
          This method is called when a unexpected message is received.
protected  void handlePropose(ACLMessage msg, ArrayList<ACLMessage> accepted)
          This method is called when a propose message is received.
protected  void handleRefuse(ACLMessage msg)
          This method is called when a refuse message is received.
protected  ACLMessage prepareRequest(ACLMessage msg)
          This method must returns the ACLMessage to be sent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myAgent

public QueueAgent myAgent
Constructor Detail

FIPAContractNetInitiator

public FIPAContractNetInitiator(QueueAgent agent,
                                ACLMessage msg)
Creates a new FIPA-Contract-Net interaction protocol, initiator role.

Parameters:
agent - agent is the reference to the QueueAgent Object
msg - initial message
Method Detail

action

public void action()
Runs the state machine with the communication protocol


prepareRequest

protected ACLMessage prepareRequest(ACLMessage msg)
This method must returns the ACLMessage to be sent. This default implementation just return the ACLMessage object passed in the constructor. Programmer might override the method in order to return a different ACLMessage. Note that for this simple version of protocol, the message will be just send to the first receiver set.

Parameters:
msg - the ACLMessage object passed in the constructor.
Returns:
a ACLMessage.

handlePropose

protected void handlePropose(ACLMessage msg,
                             ArrayList<ACLMessage> accepted)
This method is called when a propose message is received.

Parameters:
msg - the received propose message.
accepted - the list of ACCEPT/REJECT_PROPOSAL to be sent back.

handleRefuse

protected void handleRefuse(ACLMessage msg)
This method is called when a refuse message is received.

Parameters:
msg - the received refuse message

handleNotUnderstood

protected void handleNotUnderstood(ACLMessage msg)
This method is called when a NotUnderstood message is received.

Parameters:
msg - the received NotUnderstood message

handleInform

protected void handleInform(ACLMessage msg)
This method is called when a inform message is received.

Parameters:
msg - the received inform message

handleFailure

protected void handleFailure(ACLMessage msg)
This method is called when a failure message is received.

Parameters:
msg - the received failure message

handleOutOfSequence

protected void handleOutOfSequence(ACLMessage msg)
This method is called when a unexpected message is received.

Parameters:
msg - the received message

handleAllResponses

protected void handleAllResponses(ArrayList<ACLMessage> responses,
                                  ArrayList<ACLMessage> accepted)
This method is called when all the responses have been collected or when the timeout is expired

Parameters:
msg - the received refuse message


Copyright © 2012 GTI-IA. All Rights Reserved.