Package com.jme3.util
Class SortUtil
java.lang.Object
com.jme3.util.SortUtil
Quick and merge sort implementations that create no garbage, unlike
Arrays.sort(int[])
. The merge sort is stable, the quick sort is not.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
gsort
(Object[] a, Comparator comp) static void
static void
msort
(Object[] src, Object[] dest, int low, int high, Comparator comp) Merge sortstatic void
msort
(Object[] src, Object[] dest, Comparator comp) Merge sortstatic void
qsort
(int[] a, int lo0, int hi0, Comparator comp) static void
qsort
(Object[] a, int lo0, int hi0, Comparator comp) Quick sorts the supplied array using the specified comparator.static void
qsort
(Object[] a, Comparator comp) Quick sorts the supplied array using the specified comparator.
-
Constructor Details
-
SortUtil
public SortUtil()
-
-
Method Details
-
gsort
-
main
-
qsort
Quick sorts the supplied array using the specified comparator.- Parameters:
a
- the array to sort (not null, modified)comp
- the Comparator to use (not null)
-
qsort
Quick sorts the supplied array using the specified comparator.- Parameters:
a
- the array to sort (modified)lo0
- the index of the lowest element to include in the sort.hi0
- the index of the highest element to include in the sort.comp
- the Comparator to use (not null)
-
qsort
-
msort
Merge sort- Parameters:
src
- the source array (not null)dest
- the destination array (not null)comp
- the Comparator to use
-
msort
Merge sort- Parameters:
src
- Source arraydest
- Destination arraylow
- Index of beginning elementhigh
- Index of end elementcomp
- Comparator
-