Class ComparatorRegistry

java.lang.Object
io.deephaven.engine.table.impl.ComparatorRegistry

public class ComparatorRegistry extends Object
The ComparatorRegistry is a set of default comparators for sort operations.

Only types that are not themselves Comparable (meaning they do not have their own natural order) may be registered.

  • Field Details

  • Method Details

    • reset

      public void reset()
      Resets the Comparator registry to the default set of Comparators.

      Any user-specified comparators are discarded. Existing sort operations are not affected.

      The default set of Comparators includes lexicographical comparators for primitive, String, BigInteger, and BigDecimal arrays.

    • clear

      public void clear()
      Removes all registered comparators from the registry.

      Any default or user-specified comparators are discarded. Existing sort operations are not affected.

    • registerComparator

      public <T> void registerComparator(Class<T> type, Comparator<T> comparator)
      Adds a new Comparator for the given type to the registry.

      Existing sort operations are not affected.

      Parameters:
      type - the type to associate with this comparator, the type may not already be Comparable. To sort a type using an order other than the natural order, you must use a ComparatorSortColumn.
      comparator - the comparator to register for the given type
    • getComparator

      public <T> Comparator<T> getComparator(Class<T> type)
      Retrieves the comparator that TableOperations.sort(java.lang.String...) uses for the given type.
      Type Parameters:
      T - type's type
      Parameters:
      type - the type to retrieve the comparator for
      Returns:
      the comparator for the provided type, or null if one is not registered