public class add_plan extends DefaultInternalAction
Internal action: .add_plan
.
Description: adds plan(s) to the agent's plan library.
Parameters:
{+!g : vl(X) <- .print(X)}
).
In case this parameter is a string, the code within the string has to follow the syntax of AS plans
(e.g. "+!g : vl(X) <- .print(X)."
).
If it is a list, each plan term or string in the list will be parsed into an
AgentSpeak plan and added to the plan library.self
.end
.Examples:
.add_plan({ +b : true <- .print(b) })
: adds the plan
+b : true <- .print(b).
to the agent's plan library
with a plan label annotated with source(self)
..add_plan("+b : true <- .print(b).")
: adds the plan
+b : true <- .print(b).
to the agent's plan library
with a plan label annotated with source(self)
..add_plan({ +b : true <- .print(b) }, rafa)
: same as
the previous example, but the source of the plan is agent
"rafa"..add_plan({ +b : true <- .print(b) }, rafa, begin)
: same as
the previous example, but the plan is added in the begin of the plan library..add_plan([{+b <- .print(b)}, {+b : bel <-
.print(bel)}], rafa)
: adds both plans with "rafa" as their
sources.plan_label
,
relevant_plans
,
remove_plan
,
Serialized FormConstructor and Description |
---|
add_plan() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
execute(TransitionSystem ts,
Unifier un,
Term[] args)
Executes the internal action.
|
int |
getMaxArgs() |
int |
getMinArgs() |
canBeUsedInContext, checkArguments, destroy, prepareArguments, suspendIntention
public int getMinArgs()
getMinArgs
in class DefaultInternalAction
public int getMaxArgs()
getMaxArgs
in class DefaultInternalAction
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