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

public final Class Index

extends Object
implements Function2Arg, Function3Arg, Function4Arg, ArrayMode
Class Inheritance
All Implemented Interfaces
org.apache.poi.ss.formula.functions.ArrayMode, org.apache.poi.ss.formula.functions.Function4Arg, org.apache.poi.ss.formula.functions.Function, org.apache.poi.ss.formula.functions.Function3Arg, org.apache.poi.ss.formula.functions.Function2Arg
Imports
org.apache.poi.ss.formula.eval.BlankEval, .ErrorEval, .EvaluationException, .MissingArgEval, .OperandResolver, .RefEval, .ValueEval, org.apache.poi.ss.formula.TwoDEval

Implementation for the Excel function INDEX

Syntax :

INDEX ( reference, row_num[, column_num [, area_num]])

INDEX ( array, row_num[, column_num])

Parameter descriptions
referencetypically an area reference, possibly a union of areas
arraya literal array value (currently not supported)
row_numselects the row within the array or area reference
column_numselects column within the array or area reference. default is 1
area_numused when reference is a union of areas

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static TwoDEval
public ValueEval
public ValueEval
public ValueEval
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
srcRowIndex
,
int
column index of the cell containing the formula under evaluation
srcColumnIndex
)

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

private static ValueEval
getValueFromArea(TwoDEval ae, int pRowIx, int pColumnIx)

private static int

Returns:

the resolved 1-based index. Zero if the arg was missing or blank
resolveIndexArg
(ValueEval
a 1-based index.
arg
,
int srcCellRow, int srcCellCol)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Indexback to summary
public Index()

Method Detail

convertFirstArgback to summary
private static TwoDEval convertFirstArg(ValueEval arg0)
evaluateback to summary
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1)

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

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

see Function#evaluate(ValueEval[], int, int)

Annotations
@Override
evaluateback to summary
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2)

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

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

see Function#evaluate(ValueEval[], int, int)

Annotations
@Override
evaluateback to summary
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2, ValueEval arg3)

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

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

see Function#evaluate(ValueEval[], int, int)

Annotations
@Override
evaluateback to summary
public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex)

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.

srcRowIndex:int

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

row index of the cell containing the formula under evaluation

srcColumnIndex: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.

Annotations
@Override
getValueFromAreaback to summary
private static ValueEval getValueFromArea(TwoDEval ae, int pRowIx, int pColumnIx) throws EvaluationException
resolveIndexArgback to summary
private static int resolveIndexArg(ValueEval arg, int srcCellRow, int srcCellCol) throws EvaluationException
Parameters
arg:ValueEval

a 1-based index.

Returns:int

the resolved 1-based index. Zero if the arg was missing or blank

Exceptions
EvaluationException:
if the arg is an error value evaluates to a negative numeric value