Class JEPEmulationParser

java.lang.Object
noaa.coastwatch.util.expression.JEPEmulationParser
All Implemented Interfaces:
ExpressionParser

public class JEPEmulationParser extends Object implements 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
  • Constructor Details

    • JEPEmulationParser

      public JEPEmulationParser()
      Creates a new JEP emulation parser.
  • Method Details

    • init

      public void init(ParseImp parseImp)
      Description copied from interface: ExpressionParser
      Initializes this parser with the specified implementation.
      Specified by:
      init in interface ExpressionParser
      Parameters:
      parseImp - the parser implementation to use for variable information during parsing.
    • translate

      public String translate(String expr)
      Description copied from interface: ExpressionParser
      Translates the specified expression to Java Language syntax if possible.
      Specified by:
      translate in interface ExpressionParser
      Parameters:
      expr - the expression to translate.
    • parse

      public void parse(String expr)
      Description copied from interface: ExpressionParser
      Parses the specified expression.
      Specified by:
      parse in interface ExpressionParser
      Parameters:
      expr - the expression to parse.
    • getResultType

      public ExpressionParser.ResultType getResultType()
      Description copied from interface: ExpressionParser
      Gets the result data type.
      Specified by:
      getResultType in interface ExpressionParser
      Returns:
      the result data type.
    • getVariables

      public List<String> getVariables()
      Description copied from interface: ExpressionParser
      Gets the list of variables used in the expression.
      Specified by:
      getVariables in interface ExpressionParser
      Returns:
      the list of variable names.
    • getVariableType

      public String getVariableType(String name)
      Description copied from interface: ExpressionParser
      Gets the variable type used in the expression.
      Specified by:
      getVariableType in interface ExpressionParser
      Parameters:
      name - the variable name from the list returned by ExpressionParser.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

      public Object evaluate(EvaluateImp evalImp)
      Description copied from interface: ExpressionParser
      Evaluates the expression to a primitive wrapper object.
      Specified by:
      evaluate in interface ExpressionParser
      Parameters:
      evalImp - the evalutation implementation that provides variable values.
      Returns:
      the result value in a wrapper.
    • evaluateToDouble

      public double evaluateToDouble(EvaluateImp evalImp)
      Description copied from interface: ExpressionParser
      Evaluates the expression to a double value.
      Specified by:
      evaluateToDouble in interface ExpressionParser
      Parameters:
      evalImp - the evalutation implementation that provides variable values.
      Returns:
      the double valued result, or zero if the result is not a double.
    • main

      public static void main(String[] argv) throws Exception
      Tests this class.
      Parameters:
      argv - the array of command line parameters.
      Throws:
      Exception