com.ibm.commerce.tools.util
Class BasicQuickSortCompare

java.lang.Object
  |
  +--com.ibm.commerce.tools.util.BasicQuickSortCompare
All Implemented Interfaces:
QuickSortCompare

public final class BasicQuickSortCompare
extends java.lang.Object
implements QuickSortCompare

Provides a basic implementation of the QuickSortCompare interface. This implementation can be used if the objects being compared implement the "Comparable" interface. If the objects are String objects, you can specify a Collator object to make locale sensitive comparisons.


Field Summary
 
Fields inherited from interface com.ibm.commerce.tools.util. QuickSortCompare
COPYRIGHT
 
Constructor Summary
BasicQuickSortCompare()
          The default constructor.
BasicQuickSortCompare(java.text.Collator collator)
          This constructor lets you specify a Collator.
 
Method Summary
 int compare(java.lang.Object obj1, java.lang.Object obj2)
          Performs the quick sort by comparing the two objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicQuickSortCompare

public BasicQuickSortCompare()
The default constructor.

BasicQuickSortCompare

public BasicQuickSortCompare(java.text.Collator collator)
This constructor lets you specify a Collator.
Method Detail

compare

public int compare(java.lang.Object obj1,
                   java.lang.Object obj2)
Performs the quick sort by comparing the two objects.
Specified by:
compare in interface QuickSortCompare
Parameters:
obj1 - the first object
obj2 - the second object
Returns:
0 if the objects are equal.
A value greater than 1 if obj1 is greater than obj2.
A value less than 1 if ojb1 is less than obj2.