org.opends.server.backends.jeb
Class VLVKeyComparator
java.lang.Object
org.opends.server.backends.jeb.VLVKeyComparator
- All Implemented Interfaces:
- java.io.Serializable, java.util.Comparator<byte[]>
public class VLVKeyComparator
- extends java.lang.Object
- implements java.util.Comparator<byte[]>, java.io.Serializable
This class is used to compare the keys used in a VLV index. Each key is
made up the sort values and the entry ID of the largest entry in the sorted
set stored in the data for the key.
- See Also:
- Serialized Form
Method Summary |
int |
compare(byte[] b1,
byte[] b2)
Compares the contents of the provided byte arrays to determine their
relative order. |
int |
compare(SortValuesSet set,
int index,
long entryID,
AttributeValue[] values)
Compares the contents in the provided values set with the given values to
determine their relative order. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
equals |
VLVKeyComparator
public VLVKeyComparator(OrderingMatchingRule[] orderingRules,
boolean[] ascending)
- Construst a new VLV Key Comparator object.
- Parameters:
orderingRules
- The array of ordering rules to use when comparing
the decoded values in the key.ascending
- The array of booleans indicating the ordering for
each value.
compare
public int compare(byte[] b1,
byte[] b2)
- Compares the contents of the provided byte arrays to determine their
relative order. A key in the VLV index contains the sorted attribute values
in order followed by the 8 byte entry ID. A attribute value of length 0
means that value is null and the attribute type was not part of the entry.
A null value is always considered greater then a non null value. If all
attribute values are the same, the entry ID will be used to determine the
ordering.
When comparing partial keys (ie. keys with only the first attribute value
encoded for evaluating VLV assertion value offsets or keys with no entry
IDs), only information available in both byte keys will be used to
determine the ordering. If all available information is the same, 0 will
be returned.
- Specified by:
compare
in interface java.util.Comparator<byte[]>
- Parameters:
b1
- The first byte array to use in the comparison.b2
- The second byte array to use in the comparison.
- Returns:
- A negative integer if
b1
should come before
b2
in ascending order, a positive integer if
b1
should come after b2
in ascending
order, or zero if there is no difference between the values with
regard to ordering.
compare
public int compare(SortValuesSet set,
int index,
long entryID,
AttributeValue[] values)
throws JebException,
com.sleepycat.je.DatabaseException,
DirectoryException
- Compares the contents in the provided values set with the given values to
determine their relative order. A null value is always considered greater
then a non null value. If all attribute values are the same, the entry ID
will be used to determine the ordering.
If the given attribute values array does not contain all the values in the
sort order, any missing values will be considered as a unknown or
wildcard value instead of a nonexistant value. When comparing partial
information, only values available in both the values set and the
given values will be used to determine the ordering. If all available
information is the same, 0 will be returned.
- Parameters:
set
- The sort values set to containing the values.index
- The index of the values in the set.entryID
- The entry ID to use in the comparasion.values
- The values to use in the comparasion.
- Returns:
- A negative integer if the values in the set should come before
the given values in ascending order, a positive integer if
the values in the set should come after the given values in
ascending order, or zero if there is no difference between the
values with regard to ordering.
- Throws:
com.sleepycat.je.DatabaseException
- If an error occurs during an operation on a
JE database.
JebException
- If an error occurs during an operation on a
JE database.
DirectoryException
- If an error occurs while trying to
normalize the value (e.g., if it is
not acceptable for use with the
associated equality matching rule).