oracle.bali.share.sort
Class Sort
java.lang.Object
|
+--oracle.bali.share.sort.Sort
- public abstract class Sort
- extends java.lang.Object
Oracle bali share sorting utility class.
Constructor Summary |
Sort()
|
Method Summary |
static int[] |
indirectQSort(java.lang.Object[] items,
int numItems,
Comparator comparator)
Returns an array of indices into the items array, sorted
into ascending order of item value. |
static void |
qSort(int[] items,
int numItems,
boolean isAscending)
Sorts the specified array of integers in place via a fast sorting
algorithm (ie. |
static void |
qSort(java.lang.Object[] items,
int numItems,
Comparator comparator)
Sorts the specified array in place via a fast sorting algorithm (ie. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Sort
public Sort()
qSort
public static void qSort(java.lang.Object[] items,
int numItems,
Comparator comparator)
- Sorts the specified array in place via a fast sorting algorithm (ie.
QuickSort). The integers are sorted into ascending order.
- Parameters:
items
- The array of objects to be sortednumItems
- The number of the items in the array. This may not be
larger than item.length.comparator
- The comparator to use for determining the relative
ordering of two items.
- See Also:
Comparator
qSort
public static void qSort(int[] items,
int numItems,
boolean isAscending)
- Sorts the specified array of integers in place via a fast sorting
algorithm (ie. QuickSort).
- Parameters:
items
- The array of integers to be sortednumItems
- The number of the items in the array. This may not be
larger than item.length.ascending
- true to sort ascending, false to sort descending
indirectQSort
public static int[] indirectQSort(java.lang.Object[] items,
int numItems,
Comparator comparator)
- Returns an array of indices into the
items
array, sorted
into ascending order of item value. The items array is untouched in
this process. This allows the caller to not only create a sorted array,
but also know exactly how the array was sorted.
- Parameters:
items
- The array of objects to be sortednumItems
- The number of the items in the array. This may not be
larger than item.length.comparator
- The comparator to use for determining the relative
ordering of two items.- See Also:
Comparator