Package io.deephaven.engine.table.impl
Class SortedColumnsAttribute
java.lang.Object
io.deephaven.engine.table.impl.SortedColumnsAttribute
Helper class for managing the sorted columns attribute.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<SortingOrder>
getOrderForColumn
(Table table, String columnName) Retrieve the sorting order for a column from a table.static Optional<SortingOrder>
getOrderForColumn
(String attribute, String columnName) Retrieve the sorting order for a column from an attribute.static List<SortColumn>
getSortedColumns
(Table table) Get the columns aTable
is sorted by.static boolean
isSortedBy
(Table table, String columnName, SortingOrder order) Determine if a table is sorted by the given column and order.static void
setOrderForColumn
(BaseTable<?> table, String columnName, SortingOrder order) Mark the table as sorted by the given column.static String
setOrderForColumn
(String attribute, String columnName, SortingOrder order) Pack the desired sorting order into a String attribute.static Table
withOrderForColumn
(Table table, String columnName, SortingOrder order) Ensure that the result table is marked as sorted by the given column.
-
Method Details
-
getOrderForColumn
Retrieve the sorting order for a column from an attribute.- Parameters:
attribute
- the Table's value ofTable.SORTED_COLUMNS_ATTRIBUTE
.columnName
- the name of the column- Returns:
- an optional containing the SortingOrder of the column if defined, empty otherwise
-
getOrderForColumn
Retrieve the sorting order for a column from a table.- Parameters:
table
- the table to interrogatecolumnName
- the name of the column- Returns:
- an optional containing the SortingOrder of the column if defined, empty otherwise
-
isSortedBy
Determine if a table is sorted by the given column and order.- Parameters:
table
- the table to interrogatecolumnName
- the name of the columnorder
- the order to check for- Returns:
- true if table is sorted by columnName in the specified order
-
setOrderForColumn
Pack the desired sorting order into a String attribute.- Parameters:
attribute
- an attribute containing sorting ordercolumnName
- the column to updateorder
- the order that the column is sorted in- Returns:
- a String suitable for use as a
Table.SORTED_COLUMNS_ATTRIBUTE
value.
-
setOrderForColumn
Mark the table as sorted by the given column.- Parameters:
table
- the table to updatecolumnName
- the column to updateorder
- the order that the column is sorted in
-
withOrderForColumn
Ensure that the result table is marked as sorted by the given column.- Parameters:
table
- the table to updatecolumnName
- the column to updateorder
- the order that the column is sorted in- Returns:
table
, or a copy of it with the necessary attribute set
-
getSortedColumns
Get the columns aTable
is sorted by.- Parameters:
table
- The table to interrogate- Returns:
- A (possibly-empty) list of
SortColumns
representing columns the table is sorted on and their associated sort order
-