T-Plan Robot Enterprise 3.5.2
Build No. 3.5.2-20140701.1

com.tplan.robot.scripting
Class NumericEvaluator

java.lang.Object
  extended by com.tplan.robot.scripting.NumericEvaluator
Direct Known Subclasses:
JavaTestScriptMethodMapper, ParameterConverter, TokenParserImpl

public class NumericEvaluator
extends Object

Parser and evaluator of numeric and boolean expressions as is defined in the Numeric Expressions and Boolean Expressions chapters of the T-Plan Robot Enterprise language specification.


T-Plan Robot Enterprise, (C) 2009-2014 T-Plan Limited. All rights reserved.


Field Summary
static String[] BOOLEAN_OPERATORS
           
protected  Map booleanOperators
           
protected  boolean debug
           
static String[] NUMERIC_OPERATORS
           
protected  Map numericOperators
           
static String OPERATOR_AND
           
static String OPERATOR_CONTAINS
           
static String OPERATOR_DIVIDE
           
static String OPERATOR_ENDSWITH
           
static String OPERATOR_EQUALS
           
static String OPERATOR_EQUALS_NOT
           
static String OPERATOR_EXISTS
           
static String OPERATOR_GREATER_THAN
           
static String OPERATOR_LEFT_PARENTHESIS
           
static String OPERATOR_LOWER_THAN
           
static String OPERATOR_MATCHES
           
static String OPERATOR_MINUS
           
static String OPERATOR_MODULO
           
static String OPERATOR_MULTIPLY
           
static String OPERATOR_OR
           
static String OPERATOR_PLUS
           
static String OPERATOR_RIGHT_PARENTHESIS
           
static String OPERATOR_STARTSWITH
           
protected  Map operators
           
static String[] UNARY_OPERATORS
           
protected  Map unaryOperators
           
 
Constructor Summary
NumericEvaluator()
           
 
Method Summary
protected  Object convertResult(Object lastStackItem, Class resultType, boolean isSingleOperandExpression)
           
protected  Object convertResult(Object lastStackItem, Class resultType, boolean isSingleOperandExpression, boolean ignoreVariableCalls)
           
protected  void debug(Stack vars, Stack ops, Object token)
           
protected  String endsWithOperator(String s)
           
protected  Object evaluate(Object var1, Object var2, Object operand, ScriptingContext context)
           
protected  Object evaluate(Object var1, Object var2, Object operand, ScriptingContext context, boolean ignoreVariableCalls)
           
 Object evaluateNumericExpression(String expression, Class resultType)
           
 Object evaluateNumericExpression(String expression, Class resultType, ScriptingContext context)
           
 String[] getBinaryOperators()
           
 boolean isOperator(String s)
           
protected  boolean isUnary(Object op)
           
 List parseExpression(String expression)
           
 void test()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPERATOR_LEFT_PARENTHESIS

public static final String OPERATOR_LEFT_PARENTHESIS
See Also:
Constant Field Values

OPERATOR_RIGHT_PARENTHESIS

public static final String OPERATOR_RIGHT_PARENTHESIS
See Also:
Constant Field Values

OPERATOR_PLUS

public static final String OPERATOR_PLUS
See Also:
Constant Field Values

OPERATOR_MINUS

public static final String OPERATOR_MINUS
See Also:
Constant Field Values

OPERATOR_MULTIPLY

public static final String OPERATOR_MULTIPLY
See Also:
Constant Field Values

OPERATOR_MODULO

public static final String OPERATOR_MODULO
See Also:
Constant Field Values

OPERATOR_DIVIDE

public static final String OPERATOR_DIVIDE
See Also:
Constant Field Values

OPERATOR_EQUALS

public static final String OPERATOR_EQUALS
See Also:
Constant Field Values

OPERATOR_EQUALS_NOT

public static final String OPERATOR_EQUALS_NOT
See Also:
Constant Field Values

OPERATOR_AND

public static final String OPERATOR_AND
See Also:
Constant Field Values

OPERATOR_OR

public static final String OPERATOR_OR
See Also:
Constant Field Values

OPERATOR_GREATER_THAN

public static final String OPERATOR_GREATER_THAN
See Also:
Constant Field Values

OPERATOR_LOWER_THAN

public static final String OPERATOR_LOWER_THAN
See Also:
Constant Field Values

OPERATOR_EXISTS

public static final String OPERATOR_EXISTS
See Also:
Constant Field Values

OPERATOR_CONTAINS

public static final String OPERATOR_CONTAINS
See Also:
Constant Field Values

OPERATOR_STARTSWITH

public static final String OPERATOR_STARTSWITH
See Also:
Constant Field Values

OPERATOR_ENDSWITH

public static final String OPERATOR_ENDSWITH
See Also:
Constant Field Values

OPERATOR_MATCHES

public static final String OPERATOR_MATCHES
See Also:
Constant Field Values

NUMERIC_OPERATORS

public static final String[] NUMERIC_OPERATORS

BOOLEAN_OPERATORS

public static final String[] BOOLEAN_OPERATORS

UNARY_OPERATORS

public static final String[] UNARY_OPERATORS

debug

protected boolean debug

operators

protected Map operators

numericOperators

protected Map numericOperators

booleanOperators

protected Map booleanOperators

unaryOperators

protected Map unaryOperators
Constructor Detail

NumericEvaluator

public NumericEvaluator()
Method Detail

evaluateNumericExpression

public Object evaluateNumericExpression(String expression,
                                        Class resultType)

evaluateNumericExpression

public Object evaluateNumericExpression(String expression,
                                        Class resultType,
                                        ScriptingContext context)

isUnary

protected boolean isUnary(Object op)

debug

protected void debug(Stack vars,
                     Stack ops,
                     Object token)

convertResult

protected Object convertResult(Object lastStackItem,
                               Class resultType,
                               boolean isSingleOperandExpression)

convertResult

protected Object convertResult(Object lastStackItem,
                               Class resultType,
                               boolean isSingleOperandExpression,
                               boolean ignoreVariableCalls)

evaluate

protected Object evaluate(Object var1,
                          Object var2,
                          Object operand,
                          ScriptingContext context)

evaluate

protected Object evaluate(Object var1,
                          Object var2,
                          Object operand,
                          ScriptingContext context,
                          boolean ignoreVariableCalls)

getBinaryOperators

public String[] getBinaryOperators()

endsWithOperator

protected String endsWithOperator(String s)

isOperator

public boolean isOperator(String s)

parseExpression

public List parseExpression(String expression)

test

public void test()

T-Plan Robot Enterprise 3.5.2
Build No. 3.5.2-20140701.1