public class ReplySender extends OneShotBehaviour
Modifier and Type | Field and Description |
---|---|
static int |
NO_REPLY_SENT |
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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) |
done
reset
block, block, getAgent, getBehaviourName, getDataStore, getParent, isRunnable, onStart, restart, root, setAgent, setBehaviourName, setDataStore
public static final int NO_REPLY_SENT
public ReplySender(Agent a, java.lang.String replyKey, java.lang.String msgKey, DataStore ds)
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 bheaviourpublic ReplySender(Agent a, java.lang.String replyKey, java.lang.String msgKey)
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.public void action()
Behaviour
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.action
in class Behaviour
CompositeBehaviour
public int onEnd()
Behaviour
Behaviour
.
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
.public void setMsgKey(java.lang.String msgKey)
public void setReplyKey(java.lang.String replyKey)
public static void adjustReply(Agent myAgent, ACLMessage reply, ACLMessage msg)