org.semanticweb.kaon2.extensionapi.builtins
Class ExpressionEvaluator

java.lang.Object
  extended by org.semanticweb.kaon2.extensionapi.builtins.ExpressionEvaluator

public abstract class ExpressionEvaluator
extends java.lang.Object

Implements a builtin function that performs a certain operation on literal values that is invoked through kaon2:evaluate or kaon2:ifTrue predicates.


Constructor Summary
ExpressionEvaluator()
           
 
Method Summary
abstract  java.lang.Object evaluate(java.lang.Object[] boundValues)
          Invoked to evaluate the operation on given objects.
static
<T extends ExpressionEvaluator>
void
registerBuiltinFunction(java.lang.String functionName, java.lang.Class<T> evaluatorClass)
          Registers a builtin function under given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionEvaluator

public ExpressionEvaluator()
Method Detail

evaluate

public abstract java.lang.Object evaluate(java.lang.Object[] boundValues)
                                   throws KAON2Exception
Invoked to evaluate the operation on given objects.

Parameters:
boundValues - the array of arguments
Returns:
the value of the evaluator
Throws:
KAON2Exception - thrown if there is an error in evaluating the object

registerBuiltinFunction

public static <T extends ExpressionEvaluator> void registerBuiltinFunction(java.lang.String functionName,
                                                                           java.lang.Class<T> evaluatorClass)
Registers a builtin function under given name. The evaluatorClass parameter should point to the class implementing the evaluator. The class must have a public constructor accepting ExpressionEvaluator... as arguments.

Parameters:
functionName - the name of the function
evaluatorClass - the class of the evaluator