com.jme.util
Class SortUtil

java.lang.Object
  extended by com.jme.util.SortUtil

public class SortUtil
extends java.lang.Object

Quick and merge sort implementations that create no garbage, unlike Arrays.sort(long[]). The merge sort is stable, the quick sort is not.


Constructor Summary
SortUtil()
           
 
Method Summary
static void msort(java.lang.Object[] src, java.lang.Object[] dest, java.util.Comparator comp)
          Merge sorts the supplied array using the specified comparator.
static void msort(java.lang.Object[] src, java.lang.Object[] dest, int low, int high, java.util.Comparator comp)
          Merge sorts the supplied array using the specified comparator.
protected static void msort(java.lang.Object[] src, java.lang.Object[] dest, int low, int high, int offset, java.util.Comparator comp)
          Implements the actual merge sort.
static void qsort(int[] a, int lo0, int hi0, java.util.Comparator comp)
           
static void qsort(java.lang.Object[] a, java.util.Comparator comp)
          Quick sorts the supplied array using the specified comparator.
static void qsort(java.lang.Object[] a, int lo0, int hi0, java.util.Comparator comp)
          Quick sorts the supplied array using the specified comparator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortUtil

public SortUtil()
Method Detail

qsort

public static void qsort(java.lang.Object[] a,
                         java.util.Comparator comp)
Quick sorts the supplied array using the specified comparator.


qsort

public static void qsort(java.lang.Object[] a,
                         int lo0,
                         int hi0,
                         java.util.Comparator comp)
Quick sorts the supplied array using the specified comparator.

Parameters:
lo0 - the index of the lowest element to include in the sort.
hi0 - the index of the highest element to include in the sort.

qsort

public static void qsort(int[] a,
                         int lo0,
                         int hi0,
                         java.util.Comparator comp)

msort

public static void msort(java.lang.Object[] src,
                         java.lang.Object[] dest,
                         java.util.Comparator comp)
Merge sorts the supplied array using the specified comparator.

Parameters:
src - contains the elements to be sorted.
dest - must contain the same values as the src array.

msort

public static void msort(java.lang.Object[] src,
                         java.lang.Object[] dest,
                         int low,
                         int high,
                         java.util.Comparator comp)
Merge sorts the supplied array using the specified comparator.

Parameters:
src - contains the elements to be sorted.
dest - must contain the same values as the src array.

msort

protected static void msort(java.lang.Object[] src,
                            java.lang.Object[] dest,
                            int low,
                            int high,
                            int offset,
                            java.util.Comparator comp)
Implements the actual merge sort.