FileDocCategorySizeDatePackage
TOPSort.javaAPI DocGlassfish v2 API3120Tue May 22 16:54:34 BST 2007oracle.toplink.essentials.internal.helper

TOPSort

public class TOPSort extends Object
INTERNAL:

Fields Summary
Constructors Summary
public TOPSort()

    
Methods Summary
public static voidquicksort(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 voidquicksort(java.lang.Object[] arrayToSort, oracle.toplink.essentials.internal.helper.TOPComparison compareOperator)

        quicksort(arrayToSort, 0, arrayToSort.length - 1, compareOperator);
    
protected static voidswapElements(java.lang.Object[] arrayToSort, int index1, int index2)

        Object tempIndex = arrayToSort[index1];
        arrayToSort[index1] = arrayToSort[index2];
        arrayToSort[index2] = tempIndex;