Class LookupUtils.CompareResult
- java.lang.Object
-
- org.apache.poi.ss.formula.functions.LookupUtils.CompareResult
-
- Enclosing class:
- LookupUtils
public static final class LookupUtils.CompareResult extends Object
Enumeration to support 4 valued comparison results.Excel lookup functions have complex behaviour in the case where the lookup array has mixed types, and/or is unordered. Contrary to suggestions in some Excel documentation, there does not appear to be a universal ordering across types. The binary search algorithm used changes behaviour when the evaluated 'mid' value has a different type to the lookup value.
A simple int might have done the same job, but there is risk in confusion with the well known
Comparable.compareTo()andComparator.compare()which both use a ubiquitous 3 value result encoding.
-
-
Field Summary
Fields Modifier and Type Field Description static LookupUtils.CompareResultEQUALstatic LookupUtils.CompareResultGREATER_THANstatic LookupUtils.CompareResultLESS_THANstatic LookupUtils.CompareResultTYPE_MISMATCH
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisEqual()booleanisGreaterThan()booleanisLessThan()booleanisTypeMismatch()StringtoString()static LookupUtils.CompareResultvalueOf(boolean matches)static LookupUtils.CompareResultvalueOf(int simpleCompareResult)
-
-
-
Field Detail
-
TYPE_MISMATCH
public static final LookupUtils.CompareResult TYPE_MISMATCH
-
LESS_THAN
public static final LookupUtils.CompareResult LESS_THAN
-
EQUAL
public static final LookupUtils.CompareResult EQUAL
-
GREATER_THAN
public static final LookupUtils.CompareResult GREATER_THAN
-
-
Method Detail
-
valueOf
public static LookupUtils.CompareResult valueOf(int simpleCompareResult)
-
valueOf
public static LookupUtils.CompareResult valueOf(boolean matches)
-
isTypeMismatch
public boolean isTypeMismatch()
-
isLessThan
public boolean isLessThan()
-
isEqual
public boolean isEqual()
-
isGreaterThan
public boolean isGreaterThan()
-
-