Top Constructors Methods
org.apache.poi.ss.formula.functions

public final Class Mode

extends Object
implements Function
Class Inheritance
All Implemented Interfaces
org.apache.poi.ss.formula.functions.Function
Imports
java.util.ArrayList, .Arrays, .List, org.apache.poi.ss.formula.TwoDEval, org.apache.poi.ss.formula.eval.BlankEval, .BoolEval, .ErrorEval, .EvaluationException, .NumberEval, .RefEval, .StringEval, .ValueEval

Constructor Summary

AccessConstructor and Description
public
Mode()

Method Summary

Modifier and TypeMethod and Description
private static void
collectValue(ValueEval arg, List<Double> temp, boolean mustBeNumber)

private static void
public static double
evaluate(double[]
An array of values on which the mode is computed.
v
)

if v is zero length or contains no duplicates, return value is Double.NaN.

public 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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Modeback to summary
public Mode()

Method Detail

collectValueback to summary
private static void collectValue(ValueEval arg, List<Double> temp, boolean mustBeNumber) throws EvaluationException
collectValuesback to summary
private static void collectValues(ValueEval arg, List<Double> temp) throws EvaluationException
evaluateback to summary
public static double evaluate(double[] v) throws EvaluationException

if v is zero length or contains no duplicates, return value is Double.NaN. Else returns the value that occurs most times and if there is a tie, returns the first such value.

Parameters
v:double[]

An array of values on which the mode is computed.

evaluateback to summary
public 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.