Package jason.stdlib
Class length
java.lang.Object
jason.asSemantics.DefaultInternalAction
jason.stdlib.length
- All Implemented Interfaces:
InternalAction
,Serializable
@Manual(literal=".length(argument,length)",
hint="gets the length of strings or lists",
argsHint={"the term whose length is to be determined","the resulting length"},
argsType={"string or list","number"},
examples={".length(\"abc\",X): X unifies with 3",".length([a,b],X): X unifies with 2",".length(\"a\",2): false"},
seeAlso={"jason.stdlib.concat","jason.stdlib.delete","jason.stdlib.member","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 length
extends DefaultInternalAction
Internal action: .length
.
Description: gets the length of strings or lists.
Parameters:
- + argument (string or list): the term whose length is to be determined.
- +/- length (number).
Examples:
-
.length("abc",X)
:X
unifies with 3. -
.length([a,b],X)
:X
unifies with 2. -
.length("a",2)
: false.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic InternalAction
create()
execute
(TransitionSystem ts, Unifier un, Term[] args) Executes the internal action.int
int
static NumberTerm
Methods inherited from class jason.asSemantics.DefaultInternalAction
canBeUsedInContext, checkArguments, destroy, prepareArguments, suspendIntention
-
Constructor Details
-
length
public length()
-
-
Method Details
-
create
-
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
-
getSize
-