Class ObjectColumnBinarySearchKernel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RowSetbinarySearchMatchWithConsistentEquality(@NotNull ElementSource<?> source, @NotNull RowSet selection, @NotNull SortColumn sortColumn, @NotNull Object[] searchValues, boolean usePrev) Performs a binary search on a given sortedElementSourceto find the row keys from a providedRowSetthat pass a range or match filter.static RowSetbinarySearchMatchWithGeneralEquality(@NotNull ColumnSource<?> source, @NotNull RowSet selection, @NotNull SortColumn sortColumn, @NotNull Object[] searchValues, boolean usePrev) Performs a binary search on a given sortedColumnSourceto find the row keys from a providedRowSetthat hold a value equal to one ofsearchValues.static RowSetbinarySearchMax(@NotNull ElementSource<?> source, @NotNull RowSet selection, @NotNull SortColumn sortColumn, Object max, boolean maxInc, boolean usePrev) Performs a binary search on a given sortedElementSourceto find the positions (row keys) of values less than a specified maximum.static RowSetbinarySearchMin(@NotNull ElementSource<?> source, @NotNull RowSet selection, @NotNull SortColumn sortColumn, Object min, boolean minInc, boolean usePrev) Performs a binary search on a given sortedElementSourceto find the positions (row keys) of values greater than a specified minimum.static RowSetbinarySearchMinMax(@NotNull ElementSource<?> source, @NotNull RowSet selection, @NotNull SortColumn sortColumn, Object min, Object max, boolean minInc, boolean maxInc, boolean usePrev) Performs a binary search on a given sortedElementSourceto find the positions (row keys) of values within a specified range.static RowSetbinsearchRangeFilter(@NotNull ElementSource<?> source, @NotNull RowSet selection, @NotNull SortColumn sortColumn, @NotNull AbstractRangeFilter filter, boolean usePrev) Performs a binary search on a sortedElementSourceusing bounds from anAbstractRangeFilter(eitherSingleSidedComparableRangeFilterorComparableRangeFilter), returning the row keys that satisfy the filter.
-
Constructor Details
-
ObjectColumnBinarySearchKernel
public ObjectColumnBinarySearchKernel()
-
-
Method Details
-
binsearchRangeFilter
public static RowSet binsearchRangeFilter(@NotNull @NotNull ElementSource<?> source, @NotNull @NotNull RowSet selection, @NotNull @NotNull SortColumn sortColumn, @NotNull @NotNull AbstractRangeFilter filter, boolean usePrev) Performs a binary search on a sortedElementSourceusing bounds from anAbstractRangeFilter(eitherSingleSidedComparableRangeFilterorComparableRangeFilter), returning the row keys that satisfy the filter.- Parameters:
source- The element source to search.selection- TheRowSetdefining which rows are populated and the order in which they are searched.sortColumn- ASortColumnrepresenting the sorting order.filter- The range filter supplying bounds and their inclusive flags.usePrev- If true, uses previous values instead of current values.- Returns:
- A
RowSetcontaining the row keys satisfying the filter.
-
binarySearchMatchWithConsistentEquality
public static RowSet binarySearchMatchWithConsistentEquality(@NotNull @NotNull ElementSource<?> source, @NotNull @NotNull RowSet selection, @NotNull @NotNull SortColumn sortColumn, @NotNull @NotNull Object[] searchValues, boolean usePrev) Performs a binary search on a given sortedElementSourceto find the row keys from a providedRowSetthat pass a range or match filter. The method returns theRowSetcontaining the matched row keys.Ordering alone decides a match: every row that compares equal to a search value is returned. This is valid for types whose values compare equal exactly when they are equal, as
BinarySearchKernelHelper.compareConsistentWithEquality(Class)describes, and forBigDecimal, whose match filter matches by compareTo; for any other type,binarySearchMatchWithGeneralEquality(io.deephaven.engine.table.ColumnSource<?>, io.deephaven.engine.rowset.RowSet, io.deephaven.api.SortColumn, java.lang.Object[], boolean)applies.The binary search is performed over the positions defined by
selection.RowSet.get(long)is used to map positions to row keys, ensuring O(log n) performance even when the row key space is sparse.- Parameters:
source- The element source in which the search will be performed.selection- TheRowSetdefining which rows are populated and the order in which they are searched.sortColumn- ASortColumnobject representing the sorting order of the column.searchValues- An array of keys to find within the source.usePrev- If true, the search will use the previous values (getPrevObject) instead of current values (getObject).- Returns:
- A
RowSetcontaining the row keys where the sorted keys were found.
-
binarySearchMatchWithGeneralEquality
public static RowSet binarySearchMatchWithGeneralEquality(@NotNull @NotNull ColumnSource<?> source, @NotNull @NotNull RowSet selection, @NotNull @NotNull SortColumn sortColumn, @NotNull @NotNull Object[] searchValues, boolean usePrev) Performs a binary search on a given sortedColumnSourceto find the row keys from a providedRowSetthat hold a value equal to one ofsearchValues. The method returns theRowSetcontaining the matched row keys.Correct for any
Comparabletype: ordering locates the run of rows that compare equal to a search value, andObjectComparisons.eq(Object, Object)selects the rows of that run that match.- Parameters:
source- The column source in which the search will be performed.selection- TheRowSetdefining which rows are populated and the order in which they are searched.sortColumn- ASortColumnobject representing the sorting order of the column.searchValues- An array of keys to find within the source.usePrev- If true, the search will use the previous values instead of current values.- Returns:
- A
RowSetcontaining the row keys that are equal to one of the search values.
-
binarySearchMinMax
public static RowSet binarySearchMinMax(@NotNull @NotNull ElementSource<?> source, @NotNull @NotNull RowSet selection, @NotNull @NotNull SortColumn sortColumn, Object min, Object max, boolean minInc, boolean maxInc, boolean usePrev) Performs a binary search on a given sortedElementSourceto find the positions (row keys) of values within a specified range.The binary search is performed over the positions defined by
selection.RowSet.get(long)is used to map positions to row keys, ensuring O(log n) performance even when the row key space is sparse.- Parameters:
source- The element source in which the search will be performed.selection- TheRowSetdefining which rows are populated and the order in which they are searched.sortColumn- ASortColumnobject representing the sorting order of the column.min- The minimum value of the range.max- The maximum value of the range.minInc-trueif the minimum value is inclusive,falseotherwise.maxInc-trueif the maximum value is inclusive,falseotherwise.usePrev- If true, the search will use the previous values (getPrevObject) instead of current values (getObject).- Returns:
- A
RowSetcontaining the row keys where the values were found.
-
binarySearchMin
public static RowSet binarySearchMin(@NotNull @NotNull ElementSource<?> source, @NotNull @NotNull RowSet selection, @NotNull @NotNull SortColumn sortColumn, Object min, boolean minInc, boolean usePrev) Performs a binary search on a given sortedElementSourceto find the positions (row keys) of values greater than a specified minimum.The binary search is performed over the positions defined by
selection.RowSet.get(long)is used to map positions to row keys, ensuring O(log n) performance even when the row key space is sparse.- Parameters:
source- The element source in which the search will be performed.selection- TheRowSetdefining which rows are populated and the order in which they are searched.sortColumn- ASortColumnobject representing the sorting order of the column.min- The minimum value of the range.minInc-trueif the minimum value is inclusive,falseotherwise.usePrev- If true, the search will use the previous values (getPrevObject) instead of current values (getObject).- Returns:
- A
RowSetcontaining the row keys where the values were found.
-
binarySearchMax
public static RowSet binarySearchMax(@NotNull @NotNull ElementSource<?> source, @NotNull @NotNull RowSet selection, @NotNull @NotNull SortColumn sortColumn, Object max, boolean maxInc, boolean usePrev) Performs a binary search on a given sortedElementSourceto find the positions (row keys) of values less than a specified maximum.The binary search is performed over the positions defined by
selection.RowSet.get(long)is used to map positions to row keys, ensuring O(log n) performance even when the row key space is sparse.- Parameters:
source- The element source in which the search will be performed.selection- TheRowSetdefining which rows are populated and the order in which they are searched.sortColumn- ASortColumnobject representing the sorting order of the column.max- The maximum value of the range.maxInc-trueif the maximum value is inclusive,falseotherwise.usePrev- If true, the search will use the previous values (getPrevObject) instead of current values (getObject).- Returns:
- A
RowSetcontaining the row keys where the values were found.
-