Package io.deephaven.engine.table.impl
Class ComparatorRegistry
java.lang.Object
io.deephaven.engine.table.impl.ComparatorRegistry
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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Removes all registered comparators from the registry.<T> Comparator<T>
getComparator
(Class<T> type) Retrieves the comparator thatTableOperations.sort(java.lang.String...)
uses for the given type.<T> void
registerComparator
(Class<T> type, Comparator<T> comparator) Adds a new Comparator for the given type to the registry.void
reset()
Resets the Comparator registry to the default set of Comparators.
-
Field Details
-
INSTANCE
-
-
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
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 aComparatorSortColumn
.comparator
- the comparator to register for the given type
-
getComparator
Retrieves the comparator thatTableOperations.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
-