Commit 1447f728 authored by R.W.Majeed's avatar R.W.Majeed
Browse files

Added validateExpression method to engine interface,

parent 88af41a5
......@@ -43,4 +43,11 @@ public class ECMAEvaluator implements Engine{
return ((Boolean)ret).booleanValue();
}
@Override
public void validateExpressionSyntax(String expression)
throws ScriptException {
// TODO test expression with dummy observation
}
}
......@@ -2,7 +2,28 @@ package de.sekmi.histream.eval;
import de.sekmi.histream.Observation;
/**
* Engine for evaluating expressions for observations
*
* @author Raphael
*
*/
public interface Engine {
/**
* Test the given expression for the given observation.
* @param expression expression to test
* @param fact fact to test
* @return whether the expression matches or not
* @throws ScriptException for syntax/evaluation errors
*/
public boolean test(String expression, Observation fact)throws ScriptException;
/**
* Validates that the given expression is syntactically correct.
* If the expression contains syntax errors, an exception is thrown.
* @param expression expression to validate
* @throws ScriptException syntax error
*/
public void validateExpressionSyntax(String expression)throws ScriptException;
}
......@@ -86,4 +86,11 @@ public class XPathEvaluator implements Engine{
}
return ret.booleanValue();
}
@Override
public void validateExpressionSyntax(String expression)
throws ScriptException {
// TODO test expression with dummy observation
}
}
......@@ -13,4 +13,7 @@ public class TransformationException extends IOException {
public TransformationException(String message, Throwable cause){
super(message,cause);
}
public TransformationException(String message){
super(message);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment