Package jason.stdlib
Class findall
java.lang.Object
jason.asSemantics.DefaultInternalAction
jason.stdlib.findall
- All Implemented Interfaces:
InternalAction
,Serializable
Internal action: .findall(Term,Query,List)
.
Description: builds a List of all instantiations of Term which make Query a logical consequence of the agent's BB.
Parameters:
- + term (variable or structure): the variable or structure whose
instances will "populate" the list.
- + query (logical formula): the formula used to find values for the term;
is has the same syntax as the plan context.
- +/- result (list): the result list populated with found solutions for the query.
Examples assuming the BB is currently {a(30),a(20),b(1,2),b(3,4),b(5,6),c(100),c(200),c(100)}:
-
.findall(X,a(X),L)
:L
unifies with[30,20]
. -
.findall(c(Y,X),b(X,Y),L)
:L
unifies with[c(2,1),c(4,3),c(6,5)]
. -
.findall(r(X,V1,V2), (a(X) invalid input: '&' b(V1,V2) invalid input: '&' V1*V2 invalid input: '<' X), L)
:L
unifies with[r(30,1,2),r(30,3,4),r(20,1,2),r(20,3,4)]
.
.findall(X,c(X),L)
: L
unifies with
[100,200,100]
..findall(X,.member(p(_,X),[p(a,10),p(b,20)]),L)
: L
unifies with
[10,20]
.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkArguments
(Term[] args) execute
(TransitionSystem ts, Unifier un, Term[] args) Executes the internal action.int
int
Term[]
prepareArguments
(Literal body, Unifier un) Prepare body's terms to be used in 'execute', normally it consist of cloning and applying each termMethods inherited from class jason.asSemantics.DefaultInternalAction
canBeUsedInContext, destroy, suspendIntention
-
Constructor Details
-
findall
public findall()
-
-
Method Details
-
getMinArgs
public int getMinArgs()- Overrides:
getMinArgs
in classDefaultInternalAction
-
getMaxArgs
public int getMaxArgs()- Overrides:
getMaxArgs
in classDefaultInternalAction
-
prepareArguments
Description copied from interface:InternalAction
Prepare body's terms to be used in 'execute', normally it consist of cloning and applying each term- Specified by:
prepareArguments
in interfaceInternalAction
- Overrides:
prepareArguments
in classDefaultInternalAction
-
checkArguments
- Overrides:
checkArguments
in classDefaultInternalAction
- Throws:
JasonException
-
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
-