Overview  Package   Class  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

sajas.proto
Class SimpleAchieveREInitiator
java.lang.Object
  sajas.core.behaviours.Behaviour
      sajas.core.behaviours.SimpleBehaviour
          sajas.proto.SimpleAchieveREInitiator
All Implemented Interfaces:
jade.util.leap.Serializable, Serializable

public class SimpleAchieveREInitiator
extends SimpleBehaviour
Note: this class has been re-implemented to redirect the use of the agent and behaviour classes to SAJaS versions.
Author:
hlc
See Also:
jade.proto.SimpleAchieveREInitiator

Nested classes/interfaces inherited from class sajas.core.behaviours.Behaviour
Behaviour.RunnableChangedEvent
Field Summary
String
ALL_RESPONSES_KEY
          key to retrive all the responses received.
String
ALL_RESULT_NOTIFICATIONS_KEY
          key to retrive the result notification received.
String
REQUEST_KEY
          key to retrive from the datastore the ACLMessage passed in the constructor
String
REQUEST_SENT_KEY
          key to retrive from the datastore the ACLMessage that has been sent.
String
SECOND_REPLY_KEY
          key to retrive the second reply received.
Fields inherited from class sajas.core.behaviours.Behaviour
myAgent, myEvent, NOTIFY_DOWN, NOTIFY_UP, parent, STATE_BLOCKED, STATE_READY, STATE_RUNNING
Constructor Summary
SimpleAchieveREInitiator(Agent a, jade.lang.acl.ACLMessage msg)
          Construct for the class by creating a new empty DataStore
SimpleAchieveREInitiator(Agent a, jade.lang.acl.ACLMessage msg, DataStore store)
          Constructs a SimpleAchieveREInitiator behaviour
Method Summary
void
action()
          Runs the behaviour.
boolean
done()
          Check if this behaviour is done.
protected void
handleAgree(jade.lang.acl.ACLMessage msg)
          This method is called every time an agree message is received, which is not out-of-sequence according to the protocol rules.
protected void
handleAllResponses(Vector msgs)
          This method is called when all the responses have been collected or when the timeout is expired.
protected void
handleAllResultNotifications(Vector msgs)
          This method is called when all the result notification messages have been collected.
protected void
handleFailure(jade.lang.acl.ACLMessage msg)
          This method is called every time a failure message is received, which is not out-of-sequence according to the protocol rules.
protected void
handleInform(jade.lang.acl.ACLMessage msg)
          This method is called every time a inform message is received, which is not out-of-sequence according to the protocol rules.
protected void
handleNotUnderstood(jade.lang.acl.ACLMessage msg)
          This method is called every time a not-understood message is received, which is not out-of-sequence according to the protocol rules.
protected void
handleOutOfSequence(jade.lang.acl.ACLMessage msg)
          This method is called every time a message is received, which is out-of-sequence according to the protocol rules.
protected void
handleRefuse(jade.lang.acl.ACLMessage msg)
          This method is called every time a refuse message is received, which is not out-of-sequence according to the protocol rules.
void
onStart()
          This method is just an empty placeholders for subclasses.
protected jade.lang.acl.ACLMessage
prepareRequest(jade.lang.acl.ACLMessage msg)
          This method must return the ACLMessage to be sent.
void
reset()
          This method resets this behaviour so that it restarts from the initial state of the protocol with a null message.
void
reset(jade.lang.acl.ACLMessage msg)
          This method resets this behaviour so that it restarts the protocol with another request message.
Methods inherited from class sajas.core.behaviours.Behaviour
actionWrapper, block, block, getAgent, getBehaviourName, getDataStore, getExecutionState, getParent, getRestartCounter, handle, handleBlockEvent, handleRestartEvent, isRunnable, onEnd, restart, root, setAgent, setBehaviourName, setDataStore, setExecutionState
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail
ALL_RESPONSES_KEY
public final String ALL_RESPONSES_KEY
key to retrive all the responses received.

ALL_RESULT_NOTIFICATIONS_KEY
public final String ALL_RESULT_NOTIFICATIONS_KEY
key to retrive the result notification received.

REQUEST_KEY
public final String REQUEST_KEY
key to retrive from the datastore the ACLMessage passed in the constructor

REQUEST_SENT_KEY
public final String REQUEST_SENT_KEY
key to retrive from the datastore the ACLMessage that has been sent.

SECOND_REPLY_KEY
public final String SECOND_REPLY_KEY
key to retrive the second reply received.
Constructor Detail
SimpleAchieveREInitiator
public SimpleAchieveREInitiator(Agent a,
                                jade.lang.acl.ACLMessage msg)
Construct for the class by creating a new empty DataStore
See Also:
SimpleAchieveREInitiator(Agent, ACLMessage, DataStore)

SimpleAchieveREInitiator
public SimpleAchieveREInitiator(Agent a,
                                jade.lang.acl.ACLMessage msg,
                                DataStore store)
Constructs a SimpleAchieveREInitiator behaviour
Parameters:
a - The agent performing the protocol
msg - The message that must be used to initiate the protocol. Notice that in this simple implementation, the prepareMessage method returns a single message.
Method Detail
action
public final void action()
Description copied from class: Behaviour
Runs the behaviour. This abstract method must be implemented by Behavioursubclasses to perform ordinary behaviour duty. An agent schedules its behaviours calling their action() method; since all the behaviours belonging to the same agent are scheduled cooperatively, this method must not enter in an endless loop and should return as soon as possible to preserve agent responsiveness. To split a long and slow task into smaller section, recursive behaviour aggregation may be used.
Overrides:
action in class Behaviour

onStart
public void onStart()
Description copied from class: Behaviour
This method is just an empty placeholders for subclasses. It is executed just once before starting behaviour execution. Therefore, it acts as a prolog to the task represented by this Behaviour.
Overrides:
onStart in class Behaviour

done
public boolean done()
Description copied from class: Behaviour
Check if this behaviour is done. The agent scheduler calls this method to see whether a Behaviour still need to be run or it has completed its task. Concrete behaviours must implement this method to return their completion state. Finished behaviours are removed from the scheduling queue, while others are kept within to be run again when their turn comes again.
Overrides:
done in class Behaviour
Returns:
true if the behaviour has completely executed.

prepareRequest
protected jade.lang.acl.ACLMessage prepareRequest(jade.lang.acl.ACLMessage msg)
This method must return 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.

handleAgree
protected void handleAgree(jade.lang.acl.ACLMessage msg)
This method is called every time an agree message is received, which is not out-of-sequence according to the protocol rules. This default implementation does nothing; programmers might wish to override the method in case they need to react to this event.

handleRefuse
protected void handleRefuse(jade.lang.acl.ACLMessage msg)
This method is called every time a refuse message is received, which is not out-of-sequence according to the protocol rules. This default implementation does nothing; programmers might wish to override the method in case they need to react to this event.

handleNotUnderstood
protected void handleNotUnderstood(jade.lang.acl.ACLMessage msg)
This method is called every time a not-understood message is received, which is not out-of-sequence according to the protocol rules. This default implementation does nothing; programmers might wish to override the method in case they need to react to this event.

handleInform
protected void handleInform(jade.lang.acl.ACLMessage msg)
This method is called every time a inform message is received, which is not out-of-sequence according to the protocol rules. This default implementation does nothing; programmers might wish to override the method in case they need to react to this event.

handleFailure
protected void handleFailure(jade.lang.acl.ACLMessage msg)
This method is called every time a failure message is received, which is not out-of-sequence according to the protocol rules. This default implementation does nothing; programmers might wish to override the method in case they need to react to this event.

handleOutOfSequence
protected void handleOutOfSequence(jade.lang.acl.ACLMessage msg)
This method is called every time a message is received, which is out-of-sequence according to the protocol rules. This default implementation does nothing; programmers might wish to override the method in case they need to react to this event.
Parameters:
msg - the received message

handleAllResponses
protected void handleAllResponses(Vector msgs)
This method is called when all the responses have been collected or when the timeout is expired. By response message we intend here all the agree, not-understood, refuse received messages, which are not not out-of-sequence according to the protocol rules. This default implementation does nothing; programmers might wish to override the method in case they need to react to this event by analysing all the messages in just one call.

handleAllResultNotifications
protected void handleAllResultNotifications(Vector msgs)
This method is called when all the result notification messages have been collected. By result notification message we intend here all the inform, failure received messages, which are not not out-of-sequence according to the protocol rules. This default implementation does nothing; programmers might wish to override the method in case they need to react to this event by analysing all the messages in just one call.

reset
public void reset()
This method resets this behaviour so that it restarts from the initial state of the protocol with a null message.
Overrides:
reset in class SimpleBehaviour

reset
public void reset(jade.lang.acl.ACLMessage msg)
This method resets this behaviour so that it restarts the protocol with another request message.
Parameters:
msg - updates message to be sent.

Overview  Package   Class  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Java API documentation generated with DocFlex/Doclet 1.6.1 using JavadocPro template set.
DocFlex/Doclet is both a multi-format Javadoc doclet and a free edition of DocFlex/Javadoc, which is a template-driven programming tool for rapid development of any Javadoc-based Java API documentation generators (i.e. doclets). If you need to customize your Javadoc without writing a full-blown doclet from scratch, DocFlex/Javadoc may be the only tool able to help you! Find out more at www.docflex.com