CoPS.agents
Class FormTeamBehaviour

java.lang.Object
  extended byContractNetInitiator
      extended byCoPS.agents.FormTeamBehaviour

public class FormTeamBehaviour
extends ContractNetInitiator

Behaviour describing the process of forming a team. Team formation achieved through the use of the contract net protocol. Modified by Kari Roessland.

See Also:
Serialized Form

Constructor Summary
FormTeamBehaviour(Agent agent, ACLMessage cfp)
          The constructor only calls the constructor of the superclass of FormTeamBehaviour - ContracntNetInitiator
 
Method Summary
protected  void handleAllResponses(java.util.Vector responses, java.util.Vector acceptances)
          Method handling all proposals being received.
protected  void handleAllResultNotifications(java.util.Vector resultNotifications)
          This method is called when all of the inform and failure messages are received, it checks if all of the agents that received an invitation has accepted to join the team.
protected  void handleFailure(ACLMessage failure)
          This method is called each time a failure message is received.
protected  void handleInform(ACLMessage inform)
          This method is called each time an inform message is received.
protected  void handleNotUnderstood(ACLMessage notUnderstood, java.util.Vector acceptances)
          This method is called every time the behaviour/agent receives a not-understood message.
protected  void handlePropose(ACLMessage propose, java.util.Vector acceptances)
          This method is called every time the behaviour/agent receives a propose message.
protected  void handleRefuse(ACLMessage refuse, java.util.Vector acceptances)
          This method is called every time the behaviour/agent receives a propose message.
 int onEnd()
           
protected  java.util.Vector prepareCfps(ACLMessage cfp)
          Method preparing all call for proposal messages being sent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormTeamBehaviour

public FormTeamBehaviour(Agent agent,
                         ACLMessage cfp)
The constructor only calls the constructor of the superclass of FormTeamBehaviour - ContracntNetInitiator

Parameters:
agent - The owner of this behaviour.
cfp - The default call-for-proposal message.
Method Detail

prepareCfps

protected java.util.Vector prepareCfps(ACLMessage cfp)
Method preparing all call for proposal messages being sent. Modified by Kari Roessland.

Parameters:
cfp - The default call-for-proposal message.
Returns:
A vector containing all of the call-for-proposal messages being sent.

handlePropose

protected void handlePropose(ACLMessage propose,
                             java.util.Vector acceptances)
This method is called every time the behaviour/agent receives a propose message. Modified by Kari Roessland.

Parameters:
propose - The incomming proposal message.
acceptances - A vector cotaining all acceptances messages.

handleNotUnderstood

protected void handleNotUnderstood(ACLMessage notUnderstood,
                                   java.util.Vector acceptances)
This method is called every time the behaviour/agent receives a not-understood message. Added by Kari Roessland.

Parameters:
notUnderstood - The incomming not-understood message.
acceptances - A vector cotaining all acceptances messages.

handleRefuse

protected void handleRefuse(ACLMessage refuse,
                            java.util.Vector acceptances)
This method is called every time the behaviour/agent receives a propose message. Added by Kari Roessland.

Parameters:
refuse - The incomming refuse message.
acceptances - A vector cotaining all acceptances messages.

handleAllResponses

protected void handleAllResponses(java.util.Vector responses,
                                  java.util.Vector acceptances)
Method handling all proposals being received. Marks the action as activated and relates it to a node representing the agents which has sent the proposal. Modified by Kari Roessland.

Parameters:
responses - All response - messages in a Vector.
acceptances - A vector containing all acceptances messages.

handleInform

protected void handleInform(ACLMessage inform)
This method is called each time an inform message is received. Added by Kari Roessland.

Parameters:
inform - An inform message

handleFailure

protected void handleFailure(ACLMessage failure)
This method is called each time a failure message is received. Added by Kari Roessland.

Parameters:
failure - A failure message.

handleAllResultNotifications

protected void handleAllResultNotifications(java.util.Vector resultNotifications)
This method is called when all of the inform and failure messages are received, it checks if all of the agents that received an invitation has accepted to join the team. If they have not, re-formation of the team is necessary. Added by Kari Roessland.

Parameters:
resultNotifications - A vector containing all of the result-notifications.

onEnd

public int onEnd()