Class ParameterComparator
- java.lang.Object
-
- de.aristaflow.adept2.model.common.tools.ParameterComparator
-
- All Implemented Interfaces:
SerialisableComparator<Parameter>
,Serializable
,Comparator<Parameter>
public class ParameterComparator extends Object implements SerialisableComparator<Parameter>
This comparator can be used to compare (process) parameters.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
paramConfKeyPos
The key for the parameter configuration providing the position of the parameter (if set).protected SerialisableComparator<UUID>
uuidComparator
The comparator comparing UUIDs unsigned, that is a leading 8 is less than a leading 7.
-
Constructor Summary
Constructors Constructor Description ParameterComparator()
Creates a newParameterComparator
with a UUID comparator comparing UUIDs unsigned.ParameterComparator(String paramConfKeyPos)
Creates a newParameterComparator
with a UUID comparator comparing UUIDs unsigned an using the designated key to retrieve the position from the parameter configuration.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(Parameter o1, Parameter o2)
static <T extends Parameter>
Collection<T>getSortedParams(Collection<T> unsortedParams)
Creates a new collection having the designated parameters sorted with this comparator.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Field Detail
-
paramConfKeyPos
protected final String paramConfKeyPos
The key for the parameter configuration providing the position of the parameter (if set). If this isnull
, the position will be ignored when comparing.
-
uuidComparator
protected final SerialisableComparator<UUID> uuidComparator
The comparator comparing UUIDs unsigned, that is a leading 8 is less than a leading 7.
-
-
Constructor Detail
-
ParameterComparator
public ParameterComparator()
Creates a newParameterComparator
with a UUID comparator comparing UUIDs unsigned.
-
ParameterComparator
public ParameterComparator(String paramConfKeyPos)
Creates a newParameterComparator
with a UUID comparator comparing UUIDs unsigned an using the designated key to retrieve the position from the parameter configuration. This may benull
.- Parameters:
paramConfKeyPos
- The key for the parameter configuration providing the position of the parameter (if set). If this isnull
, the position will be ignored when comparing.
-
-
Method Detail
-
compare
public int compare(Parameter o1, Parameter o2)
- Specified by:
compare
in interfaceComparator<Parameter>
-
getSortedParams
public static <T extends Parameter> Collection<T> getSortedParams(Collection<T> unsortedParams)
Creates a new collection having the designated parameters sorted with this comparator.- Parameters:
unsortedParams
- The unsorted collection of parameters.- Returns:
- A sorted collection of the parameters.
-
-