Package jason.stdlib
Class suffix
java.lang.Object
jason.asSemantics.DefaultInternalAction
jason.stdlib.suffix
- All Implemented Interfaces:
InternalAction
,Serializable
@Manual(literal=".suffix(suffix,list)",
hint="checks if some list is a suffix of other list, backtracking all free variables",
argsHint={"the suffix to be checked","the list where the suffix is from"},
argsType={"list","list"},
examples=".suffix([c],[a,b,c]): true.suffix([a,b],[a,b,c]): false.suffix(X,[a,b,c]): unifies X with any suffix of the list, i.e., [a,b,c], [b,c], [c], and [] in this order",
seeAlso={"jason.stdlib.concat","jason.stdlib.length","jason.stdlib.sort","jason.stdlib.nth","jason.stdlib.max","jason.stdlib.min","jason.stdlib.reverse","jason.stdlib.prefix","jason.stdlib.sublist","jason.stdlib.difference","jason.stdlib.intersection","jason.stdlib.union"})
public class suffix
extends DefaultInternalAction
Internal action: .suffix(S,L)
.
Description: checks if some list or string S is a suffix of list/string L. If S has free variables, this internal action backtracks all possible values for S.
Parameters:
- +/- suffix (list or string): the suffix to be checked.
- + list (list or string): the list where the suffix is from.
Examples:
-
.suffix([c],[a,b,c])
: true. -
.suffix([a,b],[a,b,c])
: false. -
.suffix(X,[a,b,c])
: unifies X with any suffix of the list, i.e., [a,b,c], [b,c], [c], and [] in this order. -
.suffix("c","abc")
: true. -
.suffix("ab","abc")
: false. -
.suffix(X,"abc")
: unifies X with any suffix of the string, i.e., "abc", "bc", "c", and "" in this order.
- 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
-
suffix
public suffix()
-
-
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
-