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, java.io.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: 2006-09-13 09:40:56 +0200 (mer, 13 set 2006) $ $Revision: 5897 $
- Author:
- Fabio Bellifemine - TILab, Giovanni Caire - TILab, Marco Monticone
- See Also:
- Serialized Form
Constructor Summary |
ReplySender(Agent a,
java.lang.String replyKey,
java.lang.String msgKey)
Constructor. |
ReplySender(Agent a,
java.lang.String replyKey,
java.lang.String msgKey,
DataStore ds)
Constructor. |
Method Summary |
void |
action()
Runs the behaviour. |
static void |
adjustReply(Agent myAgent,
ACLMessage reply,
ACLMessage msg)
Adjust all protocol fields and receivers in a reply to a given
message. |
int |
onEnd()
This method is just an empty placeholder for subclasses. |
void |
setMsgKey(java.lang.String msgKey)
|
void |
setReplyKey(java.lang.String replyKey)
|
Methods inherited from class jade.core.behaviours.Behaviour |
block, block, getBehaviourName, getDataStore, getParent, isRunnable, onStart, restart, root, setAgent, setBehaviourName, setDataStore |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NO_REPLY_SENT
public static final int NO_REPLY_SENT
- See Also:
- Constant Field Values
ReplySender
public ReplySender(Agent a,
java.lang.String replyKey,
java.lang.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,
java.lang.String replyKey,
java.lang.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.
action
public void action()
- Description copied from class:
Behaviour
- Runs the behaviour. This abstract method must be implemented by
Behaviour
subclasses 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.
- Specified by:
action
in class Behaviour
- See Also:
CompositeBehaviour
onEnd
public int onEnd()
- Description copied from class:
Behaviour
- This 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 this
Behaviour
.
Note that onEnd
is called after the behaviour has been
removed from the pool of behaviours to be executed by an agent.
Therefore calling
reset()
is not sufficient to cyclically repeat the task
represented by this Behaviour
. In order to achieve that,
this Behaviour
must be added again to the agent
(using myAgent.addBehaviour(this)
). The same applies to
in the case of a Behaviour
that is a child of a
ParallelBehaviour
.
- Overrides:
onEnd
in class Behaviour
- Returns:
- an integer code representing the termination value of
the behaviour.
setMsgKey
public void setMsgKey(java.lang.String msgKey)
setReplyKey
public void setReplyKey(java.lang.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.
JADE