|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jason.asSemantics.DefaultInternalAction jason.stdlib.send
public class send
Internal action: .send
.
Description: sends a message to an agent.
Parameters:
Messages with an ask illocutionary force can optionally have
arguments 3 and 4. In case they are given, .send
suspends the
intention until an answer is received and unified with arg[3]
,
or the message request times out as specified by
arg[4]
. Otherwise, the intention is not suspended and the
answer (which is a tell message) produces a belief addition event as usual.
Examples (suppose that agent jomi
is sending the
messages):
.send(rafael,tell,value(10))
: sends value(10)
to the agent named rafael
. The literal
value(10)[source(jomi)]
will be added as a belief in
rafael
's belief base..send(rafael,achieve,go(10,30)
: sends
go(10,30)
to the agent named rafael
. When
rafael
receives this message, an event
<+!go(10,30)[source(jomi)],T>
will be added in
rafael
's event queue..send(rafael,askOne,value(beer,X))
: sends
value(beer,X)
to the agent named rafael. This askOne is an
asynchronous ask since it
does not suspend jomi's intention. If rafael has, for instance, the literal
value(beer,2)
in its belief base, this belief is automatically sent to jomi. Otherwise an event
like +?value(beer,X)[source(self)]
is generated in rafael's side
and the result of this query is then sent to jomi. In the jomi's side, the rafael's answer
is added in the jomi's belief base and an event like
+value(beer,10)[source(rafael)]
is generated..send(rafael,askOne,value(beer,X),A)
: sends
value(beer,X)
to the agent named rafael
. This askOne
is a synchronous askOne, it suspends jomi
's intention until
rafael
's
answer is received. The answer (something like value(beer,10)
)
unifies with A
..send(rafael,askOne,value(beer,X),A,2000)
: as in the
previous example, but agent jomi
waits for 2 seconds. If no
message is received by then, A
unifies with
timeout
.
broadcast
,
my_name
,
Serialized FormConstructor Summary | |
---|---|
send()
|
Method Summary | |
---|---|
boolean |
canBeUsedInContext()
Return true if the internal action can be used in plans' context |
protected void |
checkArguments(Term[] args)
|
java.lang.Object |
execute(TransitionSystem ts,
Unifier un,
Term[] args)
Executes the internal action. |
int |
getMaxArgs()
|
int |
getMinArgs()
|
boolean |
suspendIntention()
Returns true if the internal action (IA) should suspend the intention where the IA is called |
Methods inherited from class jason.asSemantics.DefaultInternalAction |
---|
prepareArguments |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public send()
Method Detail |
---|
public boolean canBeUsedInContext()
InternalAction
canBeUsedInContext
in interface InternalAction
canBeUsedInContext
in class DefaultInternalAction
public int getMinArgs()
getMinArgs
in class DefaultInternalAction
public int getMaxArgs()
getMaxArgs
in class DefaultInternalAction
protected void checkArguments(Term[] args) throws JasonException
checkArguments
in class DefaultInternalAction
JasonException
public java.lang.Object execute(TransitionSystem ts, Unifier un, Term[] args) throws java.lang.Exception
InternalAction
execute
in interface InternalAction
execute
in class DefaultInternalAction
java.lang.Exception
public boolean suspendIntention()
InternalAction
suspendIntention
in interface InternalAction
suspendIntention
in class DefaultInternalAction
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |