Class SortingKey<T,​K extends java.lang.Comparable<K>>

  • Type Parameters:
    T - the type of the record.

    public final class SortingKey<T,​K extends java.lang.Comparable<K>>
    extends java.lang.Object
    A sorting key allows a dataset to be indexed by a specific (calculated) value of a record, such that duplicates have a higher probability of being in close proximity and thus a CandidateSelection may prune the search space drastically.

    Note to increase the flexibility

    • Constructor Summary

      Constructors 
      Constructor Description
      SortingKey​(@NonNull java.lang.String name, @NonNull java.util.function.Function<T,​K> keyExtractor)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      @NonNull java.util.function.Function<T,​K> getKeyExtractor()
      A calculation or simple value access to extract the key.
      @NonNull java.lang.String getName()
      The name of the sorting key.
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SortingKey

        public SortingKey​(@NonNull
                          @NonNull java.lang.String name,
                          @NonNull
                          @NonNull java.util.function.Function<T,​K> keyExtractor)
    • Method Detail

      • getName

        @NonNull
        public @NonNull java.lang.String getName()
        The name of the sorting key. Mostly used for debugging.
      • getKeyExtractor

        @NonNull
        public @NonNull java.util.function.Function<T,​K> getKeyExtractor()
        A calculation or simple value access to extract the key.

        Please try to avoid string concatenation and use CompositeValue unless you really want that semantics. String concatenation will change the sorting order if the strings in the beginning do not have the same length.

        Example: Consider the two records [Ed, Sheeran] and [Edgar, Poe]. Concatentation will change order EdgarPoe < EdSheeran.

        See Also:
        CompositeValue
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object