public class ExpressionFunction extends java.lang.Object implements ChunkFunction
ExpressionFunction
class implements the
ChunkFunction
interface to perform mathematical expression
calculations on chunk data.Modifier and Type | Class and Description |
---|---|
class |
ExpressionFunction.VariableValueSource
Provides expression variable values for this function to run.
|
Constructor and Description |
---|
ExpressionFunction() |
Modifier and Type | Method and Description |
---|---|
DataChunk |
apply(java.util.List<DataChunk> inputChunks)
Applies some function to a list of chunks.
|
void |
init(ExpressionParser parser,
DataChunk resultPrototype)
Initializes this function with the specified parser that will be used
to evaluate expression values.
|
void |
setSkipMissing(boolean flag)
Sets the skip missing flag (by default set to false).
|
public void setSkipMissing(boolean flag)
flag
- the new flag value. When the skip missing flag is set to
true, the expression is not evaluated at all if any of the input values
are set to missing. This has the advantage of saving computation time.
When the flag is set to false, the expression is always evaluated and
any missing values are used in the computation. This is important in
cases when the expression includes a test for missing values such as an
isNaN test, or if the data contains missing values that should actually
be used in a computation (in some cases, flag variables are assigned a
missing value of zero when they shouldn't be). Essentially the skip
missing flag acts as an optimization in certain cases.public void init(ExpressionParser parser, DataChunk resultPrototype)
parser
- the initialized and parsed expression parser.resultPrototype
- the result chunk prototype. The prototype will be
used to generate new results when the apply(java.util.List<noaa.coastwatch.util.chunk.DataChunk>)
method is called.public DataChunk apply(java.util.List<DataChunk> inputChunks)
ChunkFunction
apply
in interface ChunkFunction
inputChunks
- the list of chunks as input to the function.