@Internal public final class LookupUtils extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
LookupUtils.CompareResult
Enumeration to support 4 valued comparison results.
|
static interface |
LookupUtils.LookupValueComparer |
static class |
LookupUtils.MatchMode |
static class |
LookupUtils.SearchMode |
static interface |
LookupUtils.ValueVector
Represents a single row or column within an
AreaEval . |
Constructor and Description |
---|
LookupUtils() |
Modifier and Type | Method and Description |
---|---|
static LookupUtils.ValueVector |
createColumnVector(TwoDEval tableArray,
int relativeColumnIndex) |
static LookupUtils.ValueVector |
createRowVector(TwoDEval tableArray,
int relativeRowIndex) |
static LookupUtils.ValueVector |
createVector(RefEval re) |
static LookupUtils.ValueVector |
createVector(TwoDEval ae) |
static int |
lookupFirstIndexOfValue(ValueEval lookupValue,
LookupUtils.ValueVector vector,
boolean isRangeLookup) |
static LookupUtils.MatchMode |
matchMode(int m) |
static boolean |
resolveRangeLookupArg(ValueEval rangeLookupArg,
int srcCellRow,
int srcCellCol)
Resolves the last (optional) parameter (range_lookup) to the VLOOKUP and HLOOKUP functions.
|
static int |
resolveRowOrColIndexArg(ValueEval rowColIndexArg,
int srcCellRow,
int srcCellCol)
Processes the third argument to VLOOKUP, or HLOOKUP (col_index_num
or row_index_num respectively).
Sample behaviour: Sample behaviour Input ReturnValue Thrown Error 54 2.92 "5"4 "2.18e1"21 "-$2"-3* FALSE-1* TRUE0 "TRUE" #REF! "abc" #REF! "" #REF! <blank> #VALUE! Note - out of range errors (result index too high) are handled by the caller. |
static TwoDEval |
resolveTableArrayArg(ValueEval eval)
The second argument (table_array) should be an area ref, but can actually be a cell ref, in
which case it is interpreted as a 1x1 area ref.
|
static LookupUtils.SearchMode |
searchMode(int s) |
static int |
xlookupIndexOfValue(ValueEval lookupValue,
LookupUtils.ValueVector vector,
LookupUtils.MatchMode matchMode,
LookupUtils.SearchMode searchMode) |
public static LookupUtils.MatchMode matchMode(int m)
public static LookupUtils.SearchMode searchMode(int s)
public static LookupUtils.ValueVector createRowVector(TwoDEval tableArray, int relativeRowIndex)
public static LookupUtils.ValueVector createColumnVector(TwoDEval tableArray, int relativeColumnIndex)
public static LookupUtils.ValueVector createVector(TwoDEval ae)
null
if the supplied area is neither a single row nor a single columnpublic static LookupUtils.ValueVector createVector(RefEval re)
public static int resolveRowOrColIndexArg(ValueEval rowColIndexArg, int srcCellRow, int srcCellCol) throws EvaluationException
Input Return | Value | Thrown Error |
---|---|---|
5 | 4 | |
2.9 | 2 | |
"5" | 4 | |
"2.18e1" | 21 | |
"-$2" | -3 | * |
FALSE | -1 | * |
TRUE | 0 | |
"TRUE" | #REF! | |
"abc" | #REF! | |
"" | #REF! | |
<blank> | #VALUE! |
EvaluationException
- when the specified arg cannot be coerced to a non-negative integerpublic static TwoDEval resolveTableArrayArg(ValueEval eval) throws EvaluationException
EvaluationException
public static boolean resolveRangeLookupArg(ValueEval rangeLookupArg, int srcCellRow, int srcCellCol) throws EvaluationException
rangeLookupArg
- must not be null
EvaluationException
public static int lookupFirstIndexOfValue(ValueEval lookupValue, LookupUtils.ValueVector vector, boolean isRangeLookup) throws EvaluationException
EvaluationException
public static int xlookupIndexOfValue(ValueEval lookupValue, LookupUtils.ValueVector vector, LookupUtils.MatchMode matchMode, LookupUtils.SearchMode searchMode) throws EvaluationException
EvaluationException
Copyright 2022 The Apache Software Foundation or its licensors, as applicable.