Package jason.stdlib
Class intention
java.lang.Object
jason.asSemantics.DefaultInternalAction
jason.stdlib.intention
- All Implemented Interfaces:
InternalAction
,Serializable
Internal action: .intention( ID, STATE, STACK, [current])
.
Description: returns a description of an intention. It is useful
for plans that need to inspect some intention. The description of each item of the
intention stack (i.e., an intended means) has the following form:
im(plan label,trigger event,plan body term, unification function (a list of maps))
For example:
[
im(l__6[code_line(10),code_src("karlos.asl"),source(self)], {+!g3}, { .intention(I); .print(end) }, [map(I, ....)]),
im(l__5[code_line(15),code_src("karlos.asl"),source(self)], {+!g5(10)}, { !g3; .fail } , []),
im(l__4[code_line(18),code_src("karlos.asl"),source(self)], {+!start}, { !g5(X); .print(endg4) } , [map(X, test)]),
...
]
Parameters:
- +/- intention id (number): the unique identifier of the intention.
- +/- intention state (atom): the state of the intention, suspended, running, ...
- - intention stack (list, optional): all the intended means of the intention.
- + current intention (atom, optional): selects only the current intention.
Example:
-
.intention(I,_)
:I
unifies with all intention identifiers. -
.intention(I,running)
:I
unifies with identifiers of running intentions. -
.intention(I,_,S)
:S
unifies with intended means stack all intentions. -
.intention(I,_,_,current)
:I
unifies with the id of the current intention.
Notes:
- For possible states, see https://github.com/jason-lang/jason/blob/master/doc/tech/intention-states.pdf. Some states can be annotated with further details, for instance: waiting[reason(wait(5)[time(400)])]].
- In case this internal action is used in the body of a plan, the intention that
are executing the plan is used as
current
. - In case this internal action is used in the context of a plan, the intention that
produced the event is used
current
.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionexecute
(TransitionSystem ts, Unifier un, Term[] args) Executes the internal action.int
int
Methods inherited from class jason.asSemantics.DefaultInternalAction
canBeUsedInContext, checkArguments, destroy, prepareArguments, suspendIntention
-
Constructor Details
-
intention
public intention()
-
-
Method Details
-
getMinArgs
public int getMinArgs()- Overrides:
getMinArgs
in classDefaultInternalAction
-
getMaxArgs
public int getMaxArgs()- Overrides:
getMaxArgs
in classDefaultInternalAction
-
execute
Description copied from interface:InternalAction
Executes the internal action. It should return a Boolean or an Iterator. A true boolean return means that the IA was successfully executed. An Iterator result means that there is more than one answer for this IA (e.g. see member internal action). - Specified by:
execute
in interfaceInternalAction
- Overrides:
execute
in classDefaultInternalAction
- Throws:
Exception
-