Package jason.functions
Class RuleToFunction
java.lang.Object
jason.asSemantics.DefaultArithFunction
jason.functions.RuleToFunction
- All Implemented Interfaces:
ArithFunction,Serializable
Wraps a rule into a function. For example the rule
sum(X,Y,Z) :- Z = X+Y.
is wrapped in a function sum(X,Y).
To define sum as a function the user should register it using a directive in the ASL code: { register_function("myf.sum",2,"sum") } where myf.sum is the name of the function, sum is the name of the rule (or literal, or internal action) and 2 is the function's arity.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanreturns true if the arguments of the function can be unground (as in .count)booleancheckArity(int a) returns true if a is a good number of arguments for the functiondoubleevaluate(TransitionSystem ts, Term[] args) evaluates/computes the function based on the argsgetName()returns the name of the functiontoString()
-
Constructor Details
-
RuleToFunction
-
-
Method Details
-
getName
Description copied from interface:ArithFunctionreturns the name of the function- Specified by:
getNamein interfaceArithFunction- Overrides:
getNamein classDefaultArithFunction
-
checkArity
public boolean checkArity(int a) Description copied from interface:ArithFunctionreturns true if a is a good number of arguments for the function- Specified by:
checkArityin interfaceArithFunction- Overrides:
checkArityin classDefaultArithFunction
-
allowUngroundTerms
public boolean allowUngroundTerms()Description copied from interface:ArithFunctionreturns true if the arguments of the function can be unground (as in .count)- Specified by:
allowUngroundTermsin interfaceArithFunction- Overrides:
allowUngroundTermsin classDefaultArithFunction
-
evaluate
Description copied from interface:ArithFunctionevaluates/computes the function based on the args- Specified by:
evaluatein interfaceArithFunction- Overrides:
evaluatein classDefaultArithFunction- Throws:
Exception
-
toString
- Overrides:
toStringin classDefaultArithFunction
-