Package jade.proto.states
Class ReplySender
- java.lang.Object
-
- jade.core.behaviours.Behaviour
-
- jade.core.behaviours.SimpleBehaviour
-
- jade.core.behaviours.OneShotBehaviour
-
- jade.proto.states.ReplySender
-
- All Implemented Interfaces:
Serializable,Serializable
public class ReplySender extends OneShotBehaviour
This behaviour sends a reply to a given message adjusting all protocol fields and receivers. It reads in DataStore the message and the reply at the keys passed in the Constructor.- Version:
- $Date$ $Revision$
- Author:
- Fabio Bellifemine - TILab, Giovanni Caire - TILab, Marco Monticone
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jade.core.behaviours.Behaviour
Behaviour.RunnableChangedEvent
-
-
Field Summary
Fields Modifier and Type Field Description static intNO_REPLY_SENT-
Fields inherited from class jade.core.behaviours.Behaviour
myAgent, myEvent, NOTIFY_DOWN, NOTIFY_UP, parent, STATE_BLOCKED, STATE_READY, STATE_RUNNING
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedReplySender()ReplySender(Agent a, String replyKey, String msgKey)Constructor.ReplySender(Agent a, String replyKey, String msgKey, DataStore ds)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaction()Runs the behaviour.static voidadjustReply(Agent myAgent, ACLMessage reply, ACLMessage msg)Adjust all protocol fields and receivers in a reply to a given message.intonEnd()This method is just an empty placeholder for subclasses.voidsetMsgKey(String msgKey)voidsetReplyKey(String replyKey)-
Methods inherited from class jade.core.behaviours.OneShotBehaviour
done
-
Methods inherited from class jade.core.behaviours.SimpleBehaviour
reset
-
Methods inherited from class jade.core.behaviours.Behaviour
actionWrapper, block, block, getAgent, getBehaviourName, getDataStore, getExecutionState, getParent, getRestartCounter, handle, handleBlockEvent, handleRestartEvent, isRunnable, onStart, restart, root, setAgent, setBehaviourName, setDataStore, setExecutionState
-
-
-
-
Field Detail
-
NO_REPLY_SENT
public static final int NO_REPLY_SENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ReplySender
public ReplySender(Agent a, String replyKey, String msgKey, DataStore ds)
Constructor.- Parameters:
a- The Agent executing this behaviourreplyKey- DataStore's key where to read the reply messagemsgKey- DataStore's key where to read the message to reply to.ds- the dataStore for this bheaviour
-
ReplySender
public ReplySender(Agent a, String replyKey, String msgKey)
Constructor.- Parameters:
a- The Agent executing this behaviourreplyKey- DataStore's key where to read the reply messagemsgKey- DataStore's key where to read the message to reply to.
-
ReplySender
protected ReplySender()
-
-
Method Detail
-
action
public void action()
Description copied from class:BehaviourRuns the behaviour. This abstract method must be implemented byBehavioursubclasses to perform ordinary behaviour duty. An agent schedules its behaviours calling theiraction()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.- Specified by:
actionin classBehaviour- See Also:
CompositeBehaviour
-
onEnd
public int onEnd()
Description copied from class:BehaviourThis method is just an empty placeholder for subclasses. It is invoked just once after this behaviour has ended. Therefore, it acts as an epilog for the task represented by thisBehaviour.
Note thatonEndis called after the behaviour has been removed from the pool of behaviours to be executed by an agent. Therefore callingreset()is not sufficient to cyclically repeat the task represented by thisBehaviour. In order to achieve that, thisBehaviourmust be added again to the agent (usingmyAgent.addBehaviour(this)). The same applies to in the case of aBehaviourthat is a child of aParallelBehaviour.
-
setMsgKey
public void setMsgKey(String msgKey)
-
setReplyKey
public void setReplyKey(String replyKey)
-
adjustReply
public static void adjustReply(Agent myAgent, ACLMessage reply, ACLMessage msg)
Adjust all protocol fields and receivers in a reply to a given message.
-
-