Class ParseHelper

java.lang.Object
noaa.coastwatch.util.expression.ParseHelper
All Implemented Interfaces:
EvaluateImp, ParseImp

public class ParseHelper extends Object implements ParseImp, EvaluateImp
The ParseHelper class implements the ParseImp and EvaluateImp interfaces with simple data structures. All variables are reported by typeOfVariable(java.lang.String) as having type Double, and only the getDoubleProperty(int) method is allowed to be used, all others will throw an exception. The public data field can be used to set values for all variables to be used in an evaluation.
Since:
3.4.0
Author:
Peter Hollemans
  • Field Details

    • data

      public double[] data
      The data values to use in evaluation.
  • Constructor Details

    • ParseHelper

      public ParseHelper(List<String> nameList)
      Creates a new ParseHelper.
      Parameters:
      nameList - the list of valid variable names.
  • Method Details

    • indexOfVariable

      public int indexOfVariable(String varName)
      Description copied from interface: ParseImp
      Gets the index of the specified variable. The index is used to recall the variable value from an EvaluateImp instance.
      Specified by:
      indexOfVariable in interface ParseImp
      Parameters:
      varName - the variable name.
      Returns:
      the variable index, or -1 if not available.
    • typeOfVariable

      public String typeOfVariable(String varName)
      Description copied from interface: ParseImp
      Gets the type of a variable as a primitive wrapper class name.
      Specified by:
      typeOfVariable in interface ParseImp
      Parameters:
      varName - the variable name.
      Returns:
      the variable class name: Byte, Short, Integer, Long, Float, or Double. The returned value is null if the variable type is unknown.
    • getDoubleProperty

      public double getDoubleProperty(int varIndex)
      Specified by:
      getDoubleProperty in interface EvaluateImp