org.apache.directory.server.core.partition.impl.btree
Class DefaultTupleComparator<K,V>

java.lang.Object
  extended by org.apache.directory.server.core.partition.impl.btree.DefaultTupleComparator<K,V>
All Implemented Interfaces:
java.io.Serializable, TupleComparator<K,V>

public class DefaultTupleComparator<K,V>
extends java.lang.Object
implements TupleComparator<K,V>

The default implementation of a pair of comparators which compares both keys and values of a Tuple.

Version:
$Rev$, $Date$
Author:
Apache Directory Project
See Also:
Serialized Form

Constructor Summary
DefaultTupleComparator(org.apache.directory.shared.ldap.schema.comparators.SerializableComparator<K> keyComparator, org.apache.directory.shared.ldap.schema.comparators.SerializableComparator<V> valueComparator)
           
 
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.
 org.apache.directory.shared.ldap.schema.comparators.SerializableComparator<K> getKeyComparator()
          Gets the comparator used to compare keys.
 org.apache.directory.shared.ldap.schema.comparators.SerializableComparator<V> getValueComparator()
          Gets the binary comparator used to compare valuess.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTupleComparator

public DefaultTupleComparator(org.apache.directory.shared.ldap.schema.comparators.SerializableComparator<K> keyComparator,
                              org.apache.directory.shared.ldap.schema.comparators.SerializableComparator<V> valueComparator)
Method Detail

getKeyComparator

public org.apache.directory.shared.ldap.schema.comparators.SerializableComparator<K> getKeyComparator()
Description copied from interface: TupleComparator
Gets the comparator used to compare keys. May be null in which case the compareKey method will throw an UnsupportedOperationException.

Specified by:
getKeyComparator in interface TupleComparator<K,V>
Returns:
the comparator for comparing keys.

getValueComparator

public org.apache.directory.shared.ldap.schema.comparators.SerializableComparator<V> getValueComparator()
Description copied from interface: TupleComparator
Gets the binary comparator used to compare valuess. May be null in which case the compareValue method will throw an UnsupportedOperationException.

Specified by:
getValueComparator in interface TupleComparator<K,V>
Returns:
the binary comparator for comparing values.

compareKey

public int compareKey(K key1,
                      K key2)
Description copied from interface: TupleComparator
Compares key Object to determine their sorting order returning a value = to, < or > than 0.

Specified by:
compareKey in interface TupleComparator<K,V>
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

public int compareValue(V value1,
                        V value2)
Description copied from interface: TupleComparator
Comparse value Objects to determine their sorting order returning a value = to, < or > than 0.

Specified by:
compareValue in interface TupleComparator<K,V>
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-2011 Apache Software Foundation. All Rights Reserved.