Package jason.stdlib
Class member
java.lang.Object
jason.asSemantics.DefaultInternalAction
jason.stdlib.member
- All Implemented Interfaces:
InternalAction
,Serializable
@Manual(literal=".member(item,list)",
hint="checks if a given term is in a list. If the term is a free variable, backtracks all possible values",
argsHint={"the term to be checked","the list where the term should be in"},
argsType={"term","list"},
examples={".member(c,[a,b,c]): true",".member(3,[a,b,c]): false",".member(X,[a,b,c]): unifies X with any member of the list"},
seeAlso={"jason.stdlib.concat","jason.stdlib.delete","jason.stdlib.length","jason.stdlib.sort","jason.stdlib.nth","jason.stdlib.max","jason.stdlib.min","jason.stdlib.reverse","jason.stdlib.difference","jason.stdlib.intersection","jason.stdlib.union"})
public class member
extends DefaultInternalAction
Internal action: .member(T,L)
.
Description: checks if some term T is in a list L. If T is a free variable, this internal action backtracks all possible values for T.
Parameters:
- +/- member (term): the term to be checked.
- + list (list): the list where the term should be in.
Examples:
-
.member(c,[a,b,c])
: true. -
.member(3,[a,b,c])
: false. -
.member(X,[a,b,c])
: unifies X with any member of the list.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkArguments
(Term[] args) static InternalAction
create()
execute
(TransitionSystem ts, Unifier un, Term[] args) Executes the internal action.int
int
Methods inherited from class jason.asSemantics.DefaultInternalAction
canBeUsedInContext, destroy, prepareArguments, suspendIntention
-
Constructor Details
-
member
public member()
-
-
Method Details
-
create
-
getMinArgs
public int getMinArgs()- Overrides:
getMinArgs
in classDefaultInternalAction
-
getMaxArgs
public int getMaxArgs()- Overrides:
getMaxArgs
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
-