Enum NumericComparisonType

java.lang.Object
java.lang.Enum<NumericComparisonType>
de.bcxp.challenge.common.model.csv.NumericComparisonType
All Implemented Interfaces:
Serializable, Comparable<NumericComparisonType>

public enum NumericComparisonType extends Enum<NumericComparisonType>
Enumeration defining strategies for comparing numeric values when determining the "best" score in analytical operations.

This enum encapsulates a Comparator for Double values, allowing algorithms to determine whether the optimal value is the minimum or maximum score.

Each constant stores a comparator that defines the ordering for comparison.

  • Enum Constant Details

    • MAX

      public static final NumericComparisonType MAX
      Selects the biggest numeric value as the best score.
    • MIN

      public static final NumericComparisonType MIN
      Selects the smallest numeric value as the best score.
  • Field Details

    • comparator

      public final Comparator<Double> comparator

      Comparator to be used with max() function applied to a double stream.

      Usage Example:
      
        final double bestScore = comparableEntries.stream()
                       .map(IEntryWithComparableNumericTuple::getBestMatchScore)
                       .max(type.comparator)
        
  • Constructor Details

    • NumericComparisonType

      private NumericComparisonType(Comparator<Double> comparator)
  • Method Details

    • values

      public static NumericComparisonType[] 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

      public static NumericComparisonType valueOf(String name)
      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 name
      NullPointerException - if the argument is null