Package com.rapidminer.belt.util
Class Sorting
- java.lang.Object
-
- com.rapidminer.belt.util.Sorting
-
public final class Sorting extends java.lang.Object
Utility methods for sorting.- Author:
- Michael Knopf
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int[]
sort(double[] src, Order order)
Indirect stable sort of double values using the given order.static int[]
sort(int length, java.util.Comparator<java.lang.Integer> comparator, Order order)
Sorts the indices[0, 1, ..., length-1]
with respect to the given comparator and order.
-
-
-
Method Detail
-
sort
public static int[] sort(int length, java.util.Comparator<java.lang.Integer> comparator, Order order)
Sorts the indices[0, 1, ..., length-1]
with respect to the given comparator and order.- Parameters:
length
- the length of the index arraycomparator
- the comparator to useorder
- the sorting order- Returns:
- the sorted indices
-
sort
public static int[] sort(double[] src, Order order)
Indirect stable sort of double values using the given order. This method does not modify the given source array. Instead, it computes and returns an index mapping that if applied to the input results in a sorted sequence. FollowingArrays.sort(double[])
, this method uses the total order imposed by the methodDouble.compareTo(java.lang.Double)
.- Parameters:
src
- the source array (remains unchanged))order
- the sorting order- Returns:
- the index mapping resulting in a sorted sequence
- Throws:
java.lang.NullPointerException
- if the source array or the order isnull
-
-