Package jason.stdlib
Class member
java.lang.Object
jason.asSemantics.DefaultInternalAction
jason.stdlib.member
- All Implemented Interfaces:
InternalAction
,java.io.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:
concat
,length
,sort
,nth
,max
,min
,reverse
,difference
,intersection
,union
, Serialized Form
-
Field Summary
Fields Modifier and Type Field Description private static InternalAction
singleton
-
Constructor Summary
Constructors Constructor Description member()
-
Method Summary
Modifier and Type Method Description protected void
checkArguments(Term[] args)
static InternalAction
create()
java.lang.Object
execute(TransitionSystem ts, Unifier un, Term[] args)
Executes the internal action.int
getMaxArgs()
int
getMinArgs()
Methods inherited from class jason.asSemantics.DefaultInternalAction
canBeUsedInContext, destroy, prepareArguments, suspendIntention
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
singleton
-
-
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
public java.lang.Object execute(TransitionSystem ts, Unifier un, Term[] args) throws java.lang.ExceptionDescription 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:
java.lang.Exception
-