Package noaa.coastwatch.util.expression
Class JEPEmulationParser
java.lang.Object
noaa.coastwatch.util.expression.JEPEmulationParser
- All Implemented Interfaces:
ExpressionParser
The
JEPEmulationParser class emulates a JEP syntax
parser JEPParser using a high speed JEL parser JELParser
by translating the expression and emulating the output type
behaviour.- Since:
- 3.4.0
- Author:
- Peter Hollemans
-
Nested Class Summary
Nested classes/interfaces inherited from interface noaa.coastwatch.util.expression.ExpressionParser
ExpressionParser.ResultType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionevaluate(EvaluateImp evalImp) Evaluates the expression to a primitive wrapper object.doubleevaluateToDouble(EvaluateImp evalImp) Evaluates the expression to a double value.Gets the result data type.Gets the list of variables used in the expression.getVariableType(String name) Gets the variable type used in the expression.voidInitializes this parser with the specified implementation.static voidTests this class.voidParses the specified expression.Translates the specified expression to Java Language syntax if possible.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface noaa.coastwatch.util.expression.ExpressionParser
adapt, evaluateToBoolean, evaluateToByte, evaluateToFloat, evaluateToInt, evaluateToLong, evaluateToShort, getParseTree, isThreadSafe
-
Constructor Details
-
JEPEmulationParser
public JEPEmulationParser()Creates a new JEP emulation parser.
-
-
Method Details
-
init
Description copied from interface:ExpressionParserInitializes this parser with the specified implementation.- Specified by:
initin interfaceExpressionParser- Parameters:
parseImp- the parser implementation to use for variable information during parsing.
-
translate
Description copied from interface:ExpressionParserTranslates the specified expression to Java Language syntax if possible.- Specified by:
translatein interfaceExpressionParser- Parameters:
expr- the expression to translate.
-
parse
Description copied from interface:ExpressionParserParses the specified expression.- Specified by:
parsein interfaceExpressionParser- Parameters:
expr- the expression to parse.
-
getResultType
Description copied from interface:ExpressionParserGets the result data type.- Specified by:
getResultTypein interfaceExpressionParser- Returns:
- the result data type.
-
getVariables
Description copied from interface:ExpressionParserGets the list of variables used in the expression.- Specified by:
getVariablesin interfaceExpressionParser- Returns:
- the list of variable names.
-
getVariableType
Description copied from interface:ExpressionParserGets the variable type used in the expression.- Specified by:
getVariableTypein interfaceExpressionParser- Parameters:
name- the variable name from the list returned byExpressionParser.getVariables().- Returns:
- the variable class name: Byte, Short, Integer, Long, Float, or Double. The returned value is null if the variable type is unknown.
-
evaluate
Description copied from interface:ExpressionParserEvaluates the expression to a primitive wrapper object.- Specified by:
evaluatein interfaceExpressionParser- Parameters:
evalImp- the evalutation implementation that provides variable values.- Returns:
- the result value in a wrapper.
-
evaluateToDouble
Description copied from interface:ExpressionParserEvaluates the expression to a double value.- Specified by:
evaluateToDoublein interfaceExpressionParser- Parameters:
evalImp- the evalutation implementation that provides variable values.- Returns:
- the double valued result, or zero if the result is not a double.
-
main
Tests this class.- Parameters:
argv- the array of command line parameters.- Throws:
Exception
-