Top Description Inners Fields Constructors Methods
org.apache.poi.ss.formula.functions

public abstract Class MultiOperandNumericFunction

extends Object
implements Function
Class Inheritance
All Implemented Interfaces
org.apache.poi.ss.formula.functions.Function
Known Direct Subclasses
org.apache.poi.ss.formula.functions.AggregateFunction, org.apache.poi.ss.formula.functions.AggregateFunction.ValueCollector, org.apache.poi.ss.formula.functions.MatrixFunction.MutableValueCollector, org.apache.poi.ss.formula.functions.MinaMaxa, org.apache.poi.ss.formula.functions.Mirr
Imports
org.apache.poi.ss.SpreadsheetVersion, org.apache.poi.ss.formula.ThreeDEval, .TwoDEval, org.apache.poi.ss.formula.eval.BlankEval, .BoolEval, .ErrorEval, .EvaluationException, .MissingArgEval, .NumberEval, .NumericValueEval, .OperandResolver, .RefEval, .StringValueEval, .ValueEval

This is the super class for all excel function evaluator classes that take variable number of operands, and where the order of operands does not matter

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static interface
public static enum

Field Summary

Modifier and TypeField and Description
private MultiOperandNumericFunction.EvalConsumer<BlankEval, DoubleList>
private MultiOperandNumericFunction.EvalConsumer<BoolEval, DoubleList>
private MultiOperandNumericFunction.EvalConsumer<BoolEval, DoubleList>
private static final int
private MultiOperandNumericFunction.EvalConsumer<MissingArgEval, DoubleList>

Constructor Summary

AccessConstructor and Description
protected
MultiOperandNumericFunction(boolean isReferenceBoolCounted, boolean isBlankCounted)

Method Summary

Modifier and TypeMethod and Description
private void
collectValue(ValueEval ve, boolean isViaReference, DoubleList temp)

private void
collectValues(ValueEval operand, DoubleList temp)

Collects values from a single argument

public final ValueEval
evaluate(ValueEval[]
the evaluated function arguments. Empty values are represented with BlankEval or MissingArgEval, never null.
args
,
int
row index of the cell containing the formula under evaluation
srcCellRow
,
int
column index of the cell containing the formula under evaluation
srcCellCol
)

Implements org.apache.poi.ss.formula.functions.Function.evaluate.

protected abstract double
evaluate(double[] values)

protected int
getMaxNumOperands()

Maximum number of operands accepted by this function.

protected final double[]

Returns:

never null
getNumberArray
(ValueEval[] operands)

Returns a double array that contains values for the numeric cells from among the list of operands.

public boolean

Returns:

true if values in hidden rows are counted
isHiddenRowCounted
()

public boolean
isSubtotalCounted()

Whether to count nested subtotals.

public void
public void
protected boolean

Returns:

whether to parse non-numeric cells
treatStringsAsZero
()

Functions like AVERAGEA() differ from AVERAGE() in the way they handle non-numeric cells.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

blankConsumerback to summary
private MultiOperandNumericFunction.EvalConsumer<BlankEval, DoubleList> blankConsumer
boolByRefConsumerback to summary
private MultiOperandNumericFunction.EvalConsumer<BoolEval, DoubleList> boolByRefConsumer
boolByValueConsumerback to summary
private MultiOperandNumericFunction.EvalConsumer<BoolEval, DoubleList> boolByValueConsumer
DEFAULT_MAX_NUM_OPERANDSback to summary
private static final int DEFAULT_MAX_NUM_OPERANDS
missingArgConsumerback to summary
private MultiOperandNumericFunction.EvalConsumer<MissingArgEval, DoubleList> missingArgConsumer

Constructor Detail

MultiOperandNumericFunctionback to summary
protected MultiOperandNumericFunction(boolean isReferenceBoolCounted, boolean isBlankCounted)

Method Detail

collectValueback to summary
private void collectValue(ValueEval ve, boolean isViaReference, DoubleList temp) throws EvaluationException
collectValuesback to summary
private void collectValues(ValueEval operand, DoubleList temp) throws EvaluationException

Collects values from a single argument

evaluateback to summary
public final ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol)

Implements org.apache.poi.ss.formula.functions.Function.evaluate.

Parameters
args:ValueEval[]

Doc from org.apache.poi.ss.formula.functions.Function.evaluate.

the evaluated function arguments. Empty values are represented with BlankEval or MissingArgEval, never null.

srcCellRow:int

Doc from org.apache.poi.ss.formula.functions.Function.evaluate.

row index of the cell containing the formula under evaluation

srcCellCol:int

Doc from org.apache.poi.ss.formula.functions.Function.evaluate.

column index of the cell containing the formula under evaluation

Returns:ValueEval

Doc from org.apache.poi.ss.formula.functions.Function.evaluate.

The evaluated result, possibly an ErrorEval, never null

Note

- Excel uses the error code #NUM! instead of IEEE NaN, so when numeric functions evaluate to Double#NaN be sure to translate the result to ErrorEval#NUM_ERROR.

evaluateback to summary
protected abstract double evaluate(double[] values) throws EvaluationException
getMaxNumOperandsback to summary
protected int getMaxNumOperands()

Maximum number of operands accepted by this function. Subclasses may override to change default value.

getNumberArrayback to summary
protected final double[] getNumberArray(ValueEval[] operands) throws EvaluationException

Returns a double array that contains values for the numeric cells from among the list of operands. Blanks and Blank equivalent cells are ignored. Error operands or cells containing operands of type that are considered invalid and would result in #VALUE! error in excel cause this function to return null.

Returns:double[]

never null

isHiddenRowCountedback to summary
public boolean isHiddenRowCounted()
Returns:boolean

true if values in hidden rows are counted

See Also
Subtotal
isSubtotalCountedback to summary
public boolean isSubtotalCounted()

Whether to count nested subtotals.

setBlankEvalPolicyback to summary
public void setBlankEvalPolicy(MultiOperandNumericFunction.Policy policy)
setMissingArgPolicyback to summary
public void setMissingArgPolicy(MultiOperandNumericFunction.Policy policy)
treatStringsAsZeroback to summary
protected boolean treatStringsAsZero()

Functions like AVERAGEA() differ from AVERAGE() in the way they handle non-numeric cells. AVERAGEA treats booleans as 1.0 (true) and 0.0 (false). String cells are treated as 0.0 (AVERAGE() ignores the cell altogether).

Returns:boolean

whether to parse non-numeric cells

org.apache.poi.ss.formula.functions back to summary

private Class MultiOperandNumericFunction.ConsumerFactory

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.poi.ss.formula.functions.MultiOperandNumericFunction.ConsumerFactory

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static <T> MultiOperandNumericFunction.EvalConsumer<T, DoubleList>
pack-priv static MultiOperandNumericFunction.EvalConsumer<BlankEval, DoubleList>
pack-priv static MultiOperandNumericFunction.EvalConsumer<BoolEval, DoubleList>
pack-priv static MultiOperandNumericFunction.EvalConsumer<MissingArgEval, DoubleList>
private static <T> MultiOperandNumericFunction.EvalConsumer<T, DoubleList>
private static <T> MultiOperandNumericFunction.EvalConsumer<T, DoubleList>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ConsumerFactoryback to summary
private ConsumerFactory()

Method Detail

createAnyback to summary
private static <T> MultiOperandNumericFunction.EvalConsumer<T, DoubleList> createAny(MultiOperandNumericFunction.EvalConsumer<T, DoubleList> coercer, MultiOperandNumericFunction.Policy policy)
createForBlankback to summary
pack-priv static MultiOperandNumericFunction.EvalConsumer<BlankEval, DoubleList> createForBlank(MultiOperandNumericFunction.Policy policy)
createForBoolEvalback to summary
pack-priv static MultiOperandNumericFunction.EvalConsumer<BoolEval, DoubleList> createForBoolEval(MultiOperandNumericFunction.Policy policy)
createForMissingArgback to summary
pack-priv static MultiOperandNumericFunction.EvalConsumer<MissingArgEval, DoubleList> createForMissingArg(MultiOperandNumericFunction.Policy policy)
doNothingback to summary
private static <T> MultiOperandNumericFunction.EvalConsumer<T, DoubleList> doNothing()
throwValueInvalidback to summary
private static <T> MultiOperandNumericFunction.EvalConsumer<T, DoubleList> throwValueInvalid()
org.apache.poi.ss.formula.functions back to summary

private Interface MultiOperandNumericFunction.EvalConsumer<T, R>


Method Summary

Modifier and TypeMethod and Description
public void
accept(T value, R receiver)

Method Detail

acceptback to summary
public void accept(T value, R receiver) throws EvaluationException
org.apache.poi.ss.formula.functions back to summary

public final Enum MultiOperandNumericFunction.Policy

extends Enum<MultiOperandNumericFunction.Policy>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final MultiOperandNumericFunction.Policy
public static final MultiOperandNumericFunction.Policy
public static final MultiOperandNumericFunction.Policy

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static MultiOperandNumericFunction.Policy
public static MultiOperandNumericFunction.Policy[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

COERCEback to summary
public static final MultiOperandNumericFunction.Policy COERCE
ERRORback to summary
public static final MultiOperandNumericFunction.Policy ERROR
SKIPback to summary
public static final MultiOperandNumericFunction.Policy SKIP

Constructor Detail

Policyback to summary
private Policy()

Method Detail

valueOfback to summary
public static MultiOperandNumericFunction.Policy valueOf(String name)
valuesback to summary
public static MultiOperandNumericFunction.Policy[] values()