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):Lunifies with[30,20]. -
.findall(c(Y,X),b(X,Y),L):Lunifies 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):Lunifies 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckArguments(Term[] args) execute(TransitionSystem ts, Unifier un, Term[] args) Executes the internal action.intintTerm[]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:
getMinArgsin classDefaultInternalAction
-
getMaxArgs
public int getMaxArgs()- Overrides:
getMaxArgsin classDefaultInternalAction
-
prepareArguments
Description copied from interface:InternalActionPrepare body's terms to be used in 'execute', normally it consist of cloning and applying each term- Specified by:
prepareArgumentsin interfaceInternalAction- Overrides:
prepareArgumentsin classDefaultInternalAction
-
checkArguments
- Overrides:
checkArgumentsin classDefaultInternalAction- Throws:
JasonException
-
execute
Description copied from interface:InternalActionExecutes 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:
executein interfaceInternalAction- Overrides:
executein classDefaultInternalAction- Throws:
Exception
-