org.apache.directory.server.core.partition.impl.btree
Interface TupleComparator<K,V>

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
DefaultTupleComparator, ForwardIndexComparator, KeyOnlyComparator, ReverseIndexComparator

public interface TupleComparator<K,V>
extends java.io.Serializable

Used to compare the sorting order of binary data.

Version:
$Rev: 610243 $
Author:
Apache Directory Project

Method Summary
 int compareKey(K key1, K key2)
          Compares key Object to determine their sorting order returning a value = to, < or > than 0.
 int compareValue(V value1, V value2)
          Comparse value Objects to determine their sorting order returning a value = to, < or > than 0.
 SerializableComparator<K> getKeyComparator()
          Gets the comparator used to compare keys.
 SerializableComparator<V> getValueComparator()
          Gets the binary comparator used to compare valuess.
 

Method Detail

getKeyComparator

SerializableComparator<K> getKeyComparator()
Gets the comparator used to compare keys. May be null in which case the compareKey method will throw an UnsupportedOperationException.

Returns:
the comparator for comparing keys.

getValueComparator

SerializableComparator<V> getValueComparator()
Gets the binary comparator used to compare valuess. May be null in which case the compareValue method will throw an UnsupportedOperationException.

Returns:
the binary comparator for comparing values.

compareKey

int compareKey(K key1,
               K key2)
Compares key Object to determine their sorting order returning a value = to, < or > than 0.

Parameters:
key1 - the first key to compare
key2 - the other key to compare to the first
Returns:
0 if both are equal, a negative value less than 0 if the first is less than the second, or a postive value if the first is greater than the second byte array.

compareValue

int compareValue(V value1,
                 V value2)
Comparse value Objects to determine their sorting order returning a value = to, < or > than 0.

Parameters:
value1 - the first value to compare
value2 - the other value to compare to the first
Returns:
0 if both are equal, a negative value less than 0 if the first is less than the second, or a postive value if the first is greater than the second Object.


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.