Package jason.stdlib
Class type
java.lang.Object
jason.asSemantics.DefaultInternalAction
jason.stdlib.type
- All Implemented Interfaces:
InternalAction
,java.io.Serializable
@Manual(literal=".type(argument,type)", hint="retrieves types of the argument or checks whether the argument is of a given type", argsHint={"the term to be checked","the given type or a variable to retrieves types"}, argsType={"term","term or variable"}, examples={".type(\"home page\",string): true",".type(b(10),string): false",".type(b,T): unifies T with the term \'atom\' and backtracks unifying T with \'literal\' and \'ground\'",".type(X,T): unifies T with the term \'free\' if X is free, or other types if X is not free"}, seeAlso={"jason.stdlib.atom","jason.stdlib.list","jason.stdlib.literal","jason.stdlib.number","jason.stdlib.string","jason.stdlib.structure","jason.stdlib.ground"}) public class type extends DefaultInternalAction
Internal action: .type
.
Description: retrieves types of the argument.
Parameter:
- + argument (any term): the term to be checked.
- +/- type (atom or variable): the given type or a variable. Values are atoms.
Examples:
-
.type(\"home page\",string)
: true. -
.type(b(10),string)
: false. -
.type(b,T)
: unifies T with the term 'atom' and backtracks unifying T with 'literal' and 'ground'. -
.type(X,T)
: unifies T with the term 'free' if X is free, or other types if X is not free.
-
Field Summary
Fields Modifier and Type Field Description private static InternalAction
singleton
-
Constructor Summary
Constructors Constructor Description type()
-
Method Summary
Modifier and Type Method Description 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, checkArguments, 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
-
type
public type()
-
-
Method Details
-
create
-
getMinArgs
public int getMinArgs()- Overrides:
getMinArgs
in classDefaultInternalAction
-
getMaxArgs
public int getMaxArgs()- Overrides:
getMaxArgs
in classDefaultInternalAction
-
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
-