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:
  • Field Details

    • paramConfKeyPos

      protected final String paramConfKeyPos
      The key for the parameter configuration providing the position of the parameter (if set). If this is null, 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 Details

    • ParameterComparator

      public ParameterComparator()
      Creates a new ParameterComparator with a UUID comparator comparing UUIDs unsigned.
    • ParameterComparator

      public ParameterComparator(String paramConfKeyPos)
      Creates a new ParameterComparator with a UUID comparator comparing UUIDs unsigned an using the designated key to retrieve the position from the parameter configuration. This may be null.
      Parameters:
      paramConfKeyPos - The key for the parameter configuration providing the position of the parameter (if set). If this is null, the position will be ignored when comparing.
  • Method Details

    • compare

      public int compare(Parameter o1, Parameter o2)
      Specified by:
      compare in interface Comparator<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.