- java.lang.Object
-
- org.apache.lucene.util.BytesRefComparator
-
- All Implemented Interfaces:
java.util.Comparator<BytesRef>
public abstract class BytesRefComparator extends java.lang.Object implements java.util.Comparator<BytesRef>
SpecializedBytesRef
comparator thatStringSorter
has optimizations for.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
comparedBytesCount
static BytesRefComparator
NATURAL
Comparing ByteRefs in natual order.
-
Constructor Summary
Constructors Modifier Constructor Description protected
BytesRefComparator(int comparedBytesCount)
Sole constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract int
byteAt(BytesRef ref, int i)
Return the unsigned byte to use for comparison at indexi
, or-1
if all bytes that are useful for comparisons are exhausted.int
compare(BytesRef o1, BytesRef o2)
int
compare(BytesRef o1, BytesRef o2, int k)
Compare two bytes refs that first k bytes are already guaranteed to be equal.
-
-
-
Field Detail
-
NATURAL
public static final BytesRefComparator NATURAL
Comparing ByteRefs in natual order.
-
comparedBytesCount
final int comparedBytesCount
-
-
Method Detail
-
byteAt
protected abstract int byteAt(BytesRef ref, int i)
Return the unsigned byte to use for comparison at indexi
, or-1
if all bytes that are useful for comparisons are exhausted. This may only be called with a value ofi
between0
included andcomparedBytesCount
excluded.
-
compare
public final int compare(BytesRef o1, BytesRef o2)
- Specified by:
compare
in interfacejava.util.Comparator<BytesRef>
-
-