TOPSortpublic class TOPSort extends Object
Constructors Summary |
---|
public TOPSort()
|
Methods Summary |
---|
public static void | quicksort(java.lang.Object[] arrayToSort, int left, int right, oracle.toplink.essentials.internal.helper.TOPComparison compareOperator)
if (left >= right) {
return;
}
swapElements(arrayToSort, left, (left + right) / 2);
int last = left;
for (int i = left + 1; i <= right; i++) {
if (compareOperator.compare(arrayToSort[i], arrayToSort[left]) < 0) {
swapElements(arrayToSort, ++last, i);
}
}
swapElements(arrayToSort, left, last);
quicksort(arrayToSort, left, last - 1, compareOperator);
quicksort(arrayToSort, last + 1, right, compareOperator);
| public static void | quicksort(java.lang.Object[] arrayToSort, oracle.toplink.essentials.internal.helper.TOPComparison compareOperator)
quicksort(arrayToSort, 0, arrayToSort.length - 1, compareOperator);
| protected static void | swapElements(java.lang.Object[] arrayToSort, int index1, int index2)
Object tempIndex = arrayToSort[index1];
arrayToSort[index1] = arrayToSort[index2];
arrayToSort[index2] = tempIndex;
|
|