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
-
Method Summary
Modifier and TypeMethodDescriptionevaluate
(EvaluateImp evalImp) Evaluates the expression to a primitive wrapper object.double
evaluateToDouble
(EvaluateImp evalImp) Evaluates the expression to a double value.Gets the result data type.Gets the list of variables used in the expression.void
Initializes this parser with the specified implementation.static void
Tests this class.void
Parses 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, wait
Methods 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:ExpressionParser
Initializes this parser with the specified implementation.- Specified by:
init
in interfaceExpressionParser
- Parameters:
parseImp
- the parser implementation to use for variable information during parsing.
-
translate
Description copied from interface:ExpressionParser
Translates the specified expression to Java Language syntax if possible.- Specified by:
translate
in interfaceExpressionParser
- Parameters:
expr
- the expression to translate.
-
parse
Description copied from interface:ExpressionParser
Parses the specified expression.- Specified by:
parse
in interfaceExpressionParser
- Parameters:
expr
- the expression to parse.
-
getResultType
Description copied from interface:ExpressionParser
Gets the result data type.- Specified by:
getResultType
in interfaceExpressionParser
- Returns:
- the result data type.
-
getVariables
Description copied from interface:ExpressionParser
Gets the list of variables used in the expression.- Specified by:
getVariables
in interfaceExpressionParser
- Returns:
- the list of variable names.
-
evaluate
Description copied from interface:ExpressionParser
Evaluates the expression to a primitive wrapper object.- Specified by:
evaluate
in interfaceExpressionParser
- Parameters:
evalImp
- the evalutation implementation that provides variable values.- Returns:
- the result value in a wrapper.
-
evaluateToDouble
Description copied from interface:ExpressionParser
Evaluates the expression to a double value.- Specified by:
evaluateToDouble
in 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
-