org.apache.hadoop.hive.ql.util.jdbm.helper
Class ObjectBAComparator

java.lang.Object
  extended by org.apache.hadoop.hive.ql.util.jdbm.helper.ObjectBAComparator
All Implemented Interfaces:
Serializable, Comparator

public final class ObjectBAComparator
extends Object
implements Comparator, Serializable

Comparator for objects which have been serialized into byte arrays. In effect, it wraps another Comparator which compares object and provides transparent deserialization from byte array to object.

Version:
$Id: ObjectBAComparator.java,v 1.1 2002/05/31 06:33:20 boisvert Exp $
Author:
Alex Boisvert
See Also:
Serialized Form

Constructor Summary
ObjectBAComparator(Comparator comparator)
          Construct an ObjectByteArrayComparator which wraps an Object Comparator.
 
Method Summary
 int compare(Object obj1, Object obj2)
          Compare two objects.
static int compareByteArray(byte[] thisKey, byte[] otherKey)
          Compare two byte arrays.
 
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
 

Constructor Detail

ObjectBAComparator

public ObjectBAComparator(Comparator comparator)
Construct an ObjectByteArrayComparator which wraps an Object Comparator.

Parameters:
comparator - Object comparator.
Method Detail

compare

public int compare(Object obj1,
                   Object obj2)
Compare two objects.

Specified by:
compare in interface Comparator
Parameters:
obj1 - First object
obj2 - Second object
Returns:
1 if obj1 > obj2, 0 if obj1 == obj2, -1 if obj1 < obj2

compareByteArray

public static int compareByteArray(byte[] thisKey,
                                   byte[] otherKey)
Compare two byte arrays.



Copyright © 2009 The Apache Software Foundation