Package noaa.coastwatch.util.expression
Class ParseHelper
java.lang.Object
noaa.coastwatch.util.expression.ParseHelper
- All Implemented Interfaces:
EvaluateImp,ParseImp
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublegetDoubleProperty(int varIndex) intindexOfVariable(String varName) Gets the index of the specified variable.typeOfVariable(String varName) Gets the type of a variable as a primitive wrapper class name.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.EvaluateImp
getByteProperty, getFloatProperty, getIntegerProperty, getLongProperty, getShortProperty
-
Field Details
-
data
public double[] dataThe data values to use in evaluation.
-
-
Constructor Details
-
ParseHelper
Creates a newParseHelper.- Parameters:
nameList- the list of valid variable names.
-
-
Method Details
-
indexOfVariable
Description copied from interface:ParseImpGets the index of the specified variable. The index is used to recall the variable value from anEvaluateImpinstance.- Specified by:
indexOfVariablein interfaceParseImp- Parameters:
varName- the variable name.- Returns:
- the variable index, or -1 if not available.
-
typeOfVariable
Description copied from interface:ParseImpGets the type of a variable as a primitive wrapper class name.- Specified by:
typeOfVariablein interfaceParseImp- 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:
getDoublePropertyin interfaceEvaluateImp
-