public class RuleToFunction extends DefaultArithFunction
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.
Constructor and Description |
---|
RuleToFunction(java.lang.String literal,
int arity) |
Modifier and Type | Method and Description |
---|---|
boolean |
allowUngroundTerms()
returns true if the arguments of the function can be unground (as in .count)
|
boolean |
checkArity(int a)
returns true if a is a good number of arguments for the function
|
double |
evaluate(TransitionSystem ts,
Term[] args)
evaluates/computes the function based on the args
|
java.lang.String |
getName()
returns the name of the function
|
java.lang.String |
toString() |
public java.lang.String getName()
ArithFunction
getName
in interface ArithFunction
getName
in class DefaultArithFunction
public boolean checkArity(int a)
ArithFunction
checkArity
in interface ArithFunction
checkArity
in class DefaultArithFunction
public boolean allowUngroundTerms()
ArithFunction
allowUngroundTerms
in interface ArithFunction
allowUngroundTerms
in class DefaultArithFunction
public double evaluate(TransitionSystem ts, Term[] args) throws java.lang.Exception
ArithFunction
evaluate
in interface ArithFunction
evaluate
in class DefaultArithFunction
java.lang.Exception
public java.lang.String toString()
toString
in class DefaultArithFunction