org.apache.directory.server.core.partition.impl.btree
Class ForwardIndexComparator<K>

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

public class ForwardIndexComparator<K>
extends java.lang.Object
implements TupleComparator<K,java.lang.Long>

TupleComparator for index records.

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

Constructor Summary
ForwardIndexComparator(SerializableComparator<K> keyComparator)
          Creates an IndexComparator.
 
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(java.lang.Long l1, java.lang.Long l2)
          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<java.lang.Long> getValueComparator()
          Gets the binary comparator used to compare values which are the indices into the master table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForwardIndexComparator

public ForwardIndexComparator(SerializableComparator<K> keyComparator)
Creates an IndexComparator.

Parameters:
keyComparator - the table comparator to use for keys
Method Detail

getKeyComparator

public SerializableComparator<K> getKeyComparator()
Gets the comparator used to compare keys.

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

getValueComparator

public SerializableComparator<java.lang.Long> getValueComparator()
Gets the binary comparator used to compare values which are the indices into the master table.

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

compareKey

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

Specified by:
compareKey in interface TupleComparator<K,java.lang.Long>
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(java.lang.Long l1,
                        java.lang.Long l2)
Comparse value Objects to determine their sorting order returning a value = to, < or > than 0.

Specified by:
compareValue in interface TupleComparator<K,java.lang.Long>
Parameters:
l1 - the first Long value to compare
l2 - the other Long 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.