Enum SortInPlace
- All Implemented Interfaces:
Serializable
,Comparable<SortInPlace>
Sort an array and perform the same reordering of entries on other arrays.
For example, if
x = [3, 1, 2]
y = [1, 2, 3]
z = [0, 5, 7]
Sort.ASCENDING.apply(x, y, z)
will update those arrays:
x = [1, 2, 3]
y = [2, 3, 1]
z = [5, 7, 0]
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
Helper data structure holding a (double, integer) pair. -
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Comparator
<SortInPlace.PairDoubleInteger> Comparator. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
SortInPlace
(Comparator<SortInPlace.PairDoubleInteger> comparator) -
Method Summary
Modifier and TypeMethodDescriptionvoid
apply
(double[] x, double[]... yList) Sorts in place.static SortInPlace
Returns the enum constant of this type with the specified name.static SortInPlace[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
ASCENDING
Sort in ascending order. -
DESCENDING
Sort in descending order.
-
-
Field Details
-
comparator
Comparator.
-
-
Constructor Details
-
SortInPlace
- Parameters:
comparator
- Comparator.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
apply
public void apply(double[] x, double[]... yList) Sorts in place.- Parameters:
x
- Array to be sorted and used as a pattern for permutation of the other arrays.yList
- Set of arrays whose permutations of entries will follow those performed onx
.- Throws:
IllegalArgumentException
- if not all arrays have the same size.
-