Class SortUtil
- java.lang.Object
-
- gov.nih.mipav.view.renderer.WildMagic.Poisson.Octree.SortUtil
-
public class SortUtil extends java.lang.Object
Quick and merge sort implementations that create no garbage, unlikeArrays.sort(int[])
. The merge sort is stable, the quick sort is not.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
INSERTION_SORT_THRESHOLD
The size at or below which we will use insertion sort because it's probably faster.
-
Constructor Summary
Constructors Constructor Description SortUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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
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.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
qsort(int[] a, int lo0, int hi0, java.util.Comparator comp)
static void
qsort(java.lang.Object[] a, int lo0, int hi0, java.util.Comparator comp)
Quick sorts the supplied array using the specified comparator.static void
qsort(java.lang.Object[] a, java.util.Comparator comp)
Quick sorts the supplied array using the specified comparator.
-
-
-
Field Detail
-
INSERTION_SORT_THRESHOLD
private static final int INSERTION_SORT_THRESHOLD
The size at or below which we will use insertion sort because it's probably faster.- See Also:
- Constant Field Values
-
-
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.
-
-