org.apache.directory.server.core.partition.impl.btree
Class ReverseIndexComparator<V>

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

public class ReverseIndexComparator<V>
extends java.lang.Object
implements TupleComparator<java.lang.Long,V>

TupleComparator for index records.

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

Constructor Summary
ReverseIndexComparator(SerializableComparator<V> valueComparator)
          Creates an IndexComparator.
 
Method Summary
 int compareKey(java.lang.Long l1, java.lang.Long l2)
          Compares key Object to determine their sorting order returning a value = to, < or > than 0.
 int compareValue(V v1, V v2)
          Comparse value Objects to determine their sorting order returning a value = to, < or > than 0.
 SerializableComparator<java.lang.Long> getKeyComparator()
          Gets the comparator used to compare keys.
 SerializableComparator<V> getValueComparator()
          Gets the binary comparator used to compare values which are the values of attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReverseIndexComparator

public ReverseIndexComparator(SerializableComparator<V> valueComparator)
Creates an IndexComparator.

Parameters:
valueComparator - the table comparator to use for values
Method Detail

getKeyComparator

public SerializableComparator<java.lang.Long> getKeyComparator()
Gets the comparator used to compare keys.

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

getValueComparator

public SerializableComparator<V> getValueComparator()
Gets the binary comparator used to compare values which are the values of attributes.

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

compareKey

public int compareKey(java.lang.Long l1,
                      java.lang.Long l2)
Compares key Object to determine their sorting order returning a value = to, < or > than 0.

Specified by:
compareKey in interface TupleComparator<java.lang.Long,V>
Parameters:
l1 - the first long key to compare
l2 - the other long 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 v1,
                        V v2)
Comparse value Objects to determine their sorting order returning a value = to, < or > than 0.

Specified by:
compareValue in interface TupleComparator<java.lang.Long,V>
Parameters:
v1 - the first value to compare
v2 - 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.