teamSpace.agent
Class HandleActionsBehaviour

java.lang.Object
  extended byAchieveREInitiator
      extended byteamSpace.agent.HandleActionsBehaviour

public class HandleActionsBehaviour
extends AchieveREInitiator

This behaviour is a behaviour (state) in the FSMBehaviour (final-state-machine) described by the class TeamSpacePSBehaviour. When we are in this state, there are one or more actions and/or one or more PSMs to execute or handle. The behaivour implements a request protocol. Requests are made for executors of the different actions/PSMs. If everything goes OK the state transits to CheckForActionsBehaviour, else it transits to FailureBehaviour.

See Also:
Serialized Form

Constructor Summary
HandleActionsBehaviour(Agent ag, ACLMessage request, java.lang.String teamID)
          The constructor calls the super-constructor.
 
Method Summary
protected  void handleAgree(ACLMessage agree)
          Method is called when an AGREE message is received.
protected  void handleAllResultNotifications(java.util.Vector resultNotifications)
          The method is called when all result notifications are received.
protected  void handleFailure(ACLMessage failure)
          Method is called when a FAILURE message is received.
protected  void handleInform(ACLMessage inform)
          The method is called when an INFORM message is received.
protected  void handleNotUnderstood(ACLMessage notUnderstood)
          Method is called when a NOT_UNDERSTOOD message is received.
protected  void handleRefuse(ACLMessage refuse)
          Method is called when a REFUSE message is received.
 int onEnd()
          The method resets this behaviour and returns the transition (for the FSM)
protected  java.util.Vector prepareRequests(ACLMessage request)
          This method prepares the requests for executors of the different actions and PSMs that are ready to execute or compose.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HandleActionsBehaviour

public HandleActionsBehaviour(Agent ag,
                              ACLMessage request,
                              java.lang.String teamID)
The constructor calls the super-constructor.

Parameters:
ag - The agent which is the owner of this behaviour
request - The request that are sent as part of the protocol implemented by this behaviour
Method Detail

prepareRequests

protected java.util.Vector prepareRequests(ACLMessage request)
This method prepares the requests for executors of the different actions and PSMs that are ready to execute or compose. Information about action and PSMs are stored in TSAction and TSPSM -classes. This information is extracted and put into the request messages.

Parameters:
request - The default request message (a templamte)
Returns:
A Vector with request messages

handleNotUnderstood

protected void handleNotUnderstood(ACLMessage notUnderstood)
Method is called when a NOT_UNDERSTOOD message is received.

Parameters:
notUnderstood - The message

handleAgree

protected void handleAgree(ACLMessage agree)
Method is called when an AGREE message is received.

Parameters:
agree - The message

handleRefuse

protected void handleRefuse(ACLMessage refuse)
Method is called when a REFUSE message is received.

Parameters:
refuse - The message

handleFailure

protected void handleFailure(ACLMessage failure)
Method is called when a FAILURE message is received.

Parameters:
failure - The message

handleInform

protected void handleInform(ACLMessage inform)
The method is called when an INFORM message is received. If the message is a solution to an action the corresponding TSAction object is updated and added to the list executedActions. If the message is a solution to an PSM the corresponding TSPSM object is updated and added to the list executedPSMs.

Parameters:
inform - The message

handleAllResultNotifications

protected void handleAllResultNotifications(java.util.Vector resultNotifications)
The method is called when all result notifications are received. And processed actions are updated in the Team Space.

Parameters:
resultNotifications - A Vector containing all the result notifications

onEnd

public int onEnd()
The method resets this behaviour and returns the transition (for the FSM)

Returns:
The transition/result from this behaviour (state)