vec_math
Class ExpressionEvaluator

java.lang.Object
  extended by vec_math.ExpressionEvaluator

public class ExpressionEvaluator
extends Object

Combines an ExpressionNode and an ExpressionParser to actually fill parameter values into an expression and evaluate this.


Constructor Summary
ExpressionEvaluator()
           
 
Method Summary
static Boolean calculateBoolean(String exp, Map<String,Object> set)
          Returns the actual value of the expression.
static Number calculateNumber(String exp, Map<String,Object> set)
          Returns the actual value of the expression.
static void main(String[] arg)
          Test.
private static String replaceVariables(String exp, Map<String,Object> set)
           
 
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

calculateNumber

public static Number calculateNumber(String exp,
                                     Map<String,Object> set)
                              throws ParseException
Returns the actual value of the expression. Variables that are TargetDependingParameters are evaluted using the target definition. Variable names must either be substitutable from the parameter cluster handed over or specified as constants in the DTDConstants.CONSTANT section of the merit. The sequence of parameter substitution first looks up the merit's constant. Only if the variable is not a defined constant, it is evaluated using the parameter set.

Returns:
Either a Double or a Boolean
Throws:
ParseException

calculateBoolean

public static Boolean calculateBoolean(String exp,
                                       Map<String,Object> set)
                                throws ParseException
Returns the actual value of the expression. Variables that are TargetDependingParameters are evaluted using the target definition. Variable names must either be substitutable from the parameter cluster handed over or specified as constants in the DTDConstants.CONSTANT section of the merit. The sequence of parameter substitution first looks up the merit's constant. Only if the variable is not a defined constant, it is evaluated using the parameter set.

Returns:
Either a Double or a Boolean
Throws:
ParseException

replaceVariables

private static String replaceVariables(String exp,
                                       Map<String,Object> set)
                                throws ParseException
Throws:
ParseException

main

public static void main(String[] arg)
                 throws ParseException
Test. Expression from command line.

Throws:
ParseException