public class DirectBytewiseComparator extends DirectComparator
DirectSlice
The performance of Comparators implemented in Java is always
less than their C++ counterparts due to the bridging overhead,
as such you likely don't want to use this apart from benchmarking
and you most likely instead wanted
BuiltinComparator.BYTEWISE_COMPARATORnativeHandle_| Constructor and Description |
|---|
DirectBytewiseComparator(ComparatorOptions copt) |
| Modifier and Type | Method and Description |
|---|---|
int |
compare(DirectSlice a,
DirectSlice b)
Three-way key comparison
|
java.lang.String |
findShortestSeparator(java.lang.String start,
DirectSlice limit)
Used to reduce the space requirements
for internal data structures like index blocks.
|
java.lang.String |
findShortSuccessor(java.lang.String key)
Used to reduce the space requirements
for internal data structures like index blocks.
|
java.lang.String |
name()
The name of the comparator.
|
initializeNativedisposeInternalclose, disOwnNativeHandle, isOwningHandledispose, finalizepublic DirectBytewiseComparator(ComparatorOptions copt)
public java.lang.String name()
AbstractComparatorname in class AbstractComparator<DirectSlice>public int compare(DirectSlice a, DirectSlice b)
AbstractComparatorcompare in class AbstractComparator<DirectSlice>a - Slice access to first keyb - Slice access to second keypublic java.lang.String findShortestSeparator(java.lang.String start,
DirectSlice limit)
AbstractComparatorUsed to reduce the space requirements for internal data structures like index blocks.
If start < limit, you may return a new start which is a shorter string in [start, limit).
Simple comparator implementations may return null if they wish to use start unchanged. i.e., an implementation of this method that does nothing is correct.
findShortestSeparator in class AbstractComparator<DirectSlice>start - Stringlimit - of type Tpublic java.lang.String findShortSuccessor(java.lang.String key)
AbstractComparatorUsed to reduce the space requirements for internal data structures like index blocks.
You may return a new short key (key1) where key1 ≥ key.
Simple comparator implementations may return null if they wish to leave the key unchanged. i.e., an implementation of this method that does nothing is correct.
findShortSuccessor in class AbstractComparator<DirectSlice>key - String