Package jason.stdlib
Class difference
java.lang.Object
jason.asSemantics.DefaultInternalAction
jason.stdlib.difference
- All Implemented Interfaces:
InternalAction
,Serializable
- Direct Known Subclasses:
intersection
,union
@Manual(literal=".difference(arg0,arg1,arg2)",
hint="the difference between two sets",
argsHint={"the first list","the list to be compared with the first","the resulting list with the difference of the comparison"},
argsType={"list","list","list"},
examples={".difference(\"[a,b,c]\",\"[b,e]\",X): X unifies with \"[a,c]\"",".difference(\"[a,b,a,c]\",\"[f,e,a,c]\",X): X unifies with \"[b]\""},
seeAlso={"jason.stdlib.concat","jason.stdlib.delete","jason.stdlib.length","jason.stdlib.member","jason.stdlib.sort","jason.stdlib.shuffle","jason.stdlib.substring","jason.stdlib.prefix","jason.stdlib.suffix","jason.stdlib.nth","jason.stdlib.max","jason.stdlib.min","jason.stdlib.reverse","jason.stdlib.difference","jason.stdlib.intersection","jason.stdlib.union"})
public class difference
extends DefaultInternalAction
Internal action: .difference(S1,S2,S3)
.
Description: S3 is the difference between the sets S1 and S2 (represented by lists). The result set is sorted.
Parameters:
- + arg[0] (a list).
- + arg[1] (a list).
- +/- arg[2]: the difference.
Examples:
-
.difference("[a,b,c]","[b,e]",X)
:X
unifies with "[a,c]". -
.difference("[a,b,a,c]","[f,e,a,c]",X)
:X
unifies with "[b]".
- 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
-
difference
public difference()
-
-
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
-