Interface RowSet
- All Superinterfaces:
AutoCloseable,LogOutputAppendable,LongSizedDataStructure,RowSequence,SafeCloseable
- All Known Subinterfaces:
TrackingRowSet,TrackingWritableRowSet,WritableRowSet
- All Known Implementing Classes:
TrackingWritableRowSetImpl,WritableRowSetImpl
RowSequence with additional set and set-like capabilities.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRowSet.Evaluator<T extends Comparable<T>>static interfacestatic interfacestatic interfacestatic interface -
Field Summary
FieldsFields inherited from interface io.deephaven.engine.rowset.RowSequence
NULL_ROW_KEY -
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Free any resources associated with this object.booleancontainsRange(long start, long end) Queries whether this RowSet contains every element in the range provided.copy()Make a newWritableRowSetwith the same row keys asthisthat is safe for further mutation.longfind(long key) Returns the position in [0..(size-1)] where the key is found.longGet the first row key in this RowSet.default voidbooleanProvide each value contained in this RowSet, in increased sorted order to the consumer.longget(long rowPosition) Returns the row key at the given row position.voidgetKeysForPositions(PrimitiveIterator.OfLong inputPositions, LongConsumer outputKeys) Returns the sequence of (increasing) keys corresponding to the positions provided as input.@NotNull WritableRowSetReturns a new RowSet representing the intersection of the current RowSet with the input RowSetdefault WritableRowSetReturns aWritableRowSetwith the row positions ofkeysin this RowSet.Returns the row positions ofkeysin the current set as aWritableRowSet, stopping at maximumPosition.booleanisEmpty()Queries whether this RowSet is empty (i.e.default booleanisFlat()Returns whether or not this RowSet is flat.default booleanQueries whether this RowSet is non-empty (i.e.default booleandefault boolean@NotNull RowSet.Iteratoriterator()longGet the last row key in this RowSet.Returns a new RowSet representing the keys of the current set not present inside rowSetToRemove.booleanReturns true if a RowSet has any overlap.booleanoverlapsRange(long start, long end) Returns true if this RowSet has any overlap with the provided range.shift(long shiftAmount) longsize()How many keys are in this RowSet.subSetByKeyRange(long startKey, long endKey) Get a subset of this RowSet within the specified closed range of row keys.subSetByPositionRange(long startPos, long endPos) Get a subset of this RowSet within the specified half-closed range of row positions.subSetForPositions(RowSequence posRowSequence) Get a subset of this RowSet according to the supplied sequence of row positions inposRowSequence.subSetForPositions(RowSequence posRowSequence, boolean reversed) Get a subset of this RowSet according to the supplied sequence of row positions inposRowSequence.subSetForReversePositions(RowSequence posRowSequence) Get a subset of this RowSet according to the supplied sequence of row positions relative tosize()inposRowSequence.booleanReturns true if this RowSet is a (possibly improper) subset of other.default voidtoRowKeyArray(long[] vs) default voidtoRowKeyArray(long[] vs, int offset) default TrackingRowSetCast this RowSet reference to aTrackingRowSet.Returns a new RowSet representing the keys present in both this RowSet and the argument RowSet.default voidvalidate()voiddefault WritableRowSetCast this RowSet reference to aWritableRowSet.Methods inherited from interface io.deephaven.base.log.LogOutputAppendable
appendMethods inherited from interface io.deephaven.util.datastructures.LongSizedDataStructure
intSize, intSizeMethods inherited from interface io.deephaven.engine.rowset.RowSequence
asRowKeyChunk, asRowKeyRangesChunk, asRowSet, fillRowKeyChunk, fillRowKeyRangesChunk, forAllRowKeyRanges, forEachRowKeyRange, getAverageRunLengthEstimate, getRowSequenceByKeyRange, getRowSequenceByPosition, getRowSequenceIterator, isContiguous
-
Field Details
-
EMPTY_ITERATOR
-
-
Method Details
-
close
default void close()Free any resources associated with this object.
Using any
RowSetmethods afterclose()is an error and may produce exceptions or undefined results.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceRowSequence- Specified by:
closein interfaceSafeCloseable
-
copy
WritableRowSet copy()Make a newWritableRowSetwith the same row keys asthisthat is safe for further mutation. As in other operations that return aWritableRowSet, the result must beclosedby the caller when it is no longer needed. The result will never be aTrackingRowSet; useWritableRowSet.toTracking()on the result as needed.- Returns:
- The copied
WritableRowSet
-
size
long size()How many keys are in this RowSet.- Specified by:
sizein interfaceLongSizedDataStructure- Specified by:
sizein interfaceRowSequence- Returns:
- the number of keys in this RowSet.
-
isEmpty
boolean isEmpty()Queries whether this RowSet is empty (i.e. has no keys).- Specified by:
isEmptyin interfaceRowSequence- Returns:
- true if the size() of this RowSet is zero, false if the size is greater than zero
-
isNonempty
default boolean isNonempty()Queries whether this RowSet is non-empty (i.e. has at least one key).- Returns:
- true if the size() of this RowSet greater than zero, false if the size is zero
-
isFlat
default boolean isFlat()Returns whether or not this RowSet is flat. Unlike a table, this is a mutable property; which may change from step to step.- Returns:
- true if the RowSet keys are contiguous and start at zero.
-
firstRowKey
long firstRowKey()Get the first row key in this RowSet.- Specified by:
firstRowKeyin interfaceRowSequence- Returns:
- The first row key, or
RowSequence.NULL_ROW_KEYif there is none.
-
lastRowKey
long lastRowKey()Get the last row key in this RowSet.- Specified by:
lastRowKeyin interfaceRowSequence- Returns:
- The last row key, or
RowSequence.NULL_ROW_KEYif there is none.
-
invert
Returns a
WritableRowSetwith the row positions ofkeysin this RowSet.This can be thought of as an iterative find() over the values in keys, but all keys must exist within this RowSet, because a RowSet result can not represent negative values.
- Parameters:
keys- The keys to find positions for- Returns:
- A new
WritableRowSetcontaining the positions of the keys in this RowSet
-
invert
Returns the row positions of
keysin the current set as aWritableRowSet, stopping at maximumPosition.This can be thought of as an iterative
find(long)over the values in keys, but all keys must exist within this RowSet, because a RowSet result can not represent negative values.- Parameters:
keys- The keys to find positions formaximumPosition- The largest position for which we will find a key- Returns:
- A new
WritableRowSetcontaining the positions of the keys in this RowSet
-
intersect
Returns a new RowSet representing the intersection of the current RowSet with the input RowSet -
overlaps
Returns true if a RowSet has any overlap. -
overlapsRange
boolean overlapsRange(long start, long end) Returns true if this RowSet has any overlap with the provided range.- Parameters:
start- Start of range, inclusive.end- End of range, inclusive.- Returns:
- true if any value x in start <= x <= end is contained in this RowSet.
-
subsetOf
Returns true if this RowSet is a (possibly improper) subset of other.- Returns:
- true if every element of this exists within other
-
minus
Returns a new RowSet representing the keys of the current set not present inside rowSetToRemove. This operation is equivalent to set difference. This RowSet is not modified. -
union
Returns a new RowSet representing the keys present in both this RowSet and the argument RowSet.- Parameters:
rowSetToAdd- A RowSet whose keys will be joined with our own to produce a new RowSet.- Returns:
- a new RowSet with the union of the keys in both this RowSet and rowSetToAdd.
-
shift
-
forEachRowKey
Provide each value contained in this RowSet, in increased sorted order to the consumer. If the consumer returns false for a key, stops after that key (does not provide any keys after that key).- Specified by:
forEachRowKeyin interfaceRowSequence- Parameters:
lc- the consumer.- Returns:
- false if the consumer returned false at some point, true if the consumer always returned true and all values in the RowSet were consumed.
-
forAllRowKeys
- Specified by:
forAllRowKeysin interfaceRowSequence
-
toRowKeyArray
default void toRowKeyArray(long[] vs) -
toRowKeyArray
default void toRowKeyArray(long[] vs, int offset) -
subSetByPositionRange
Get a subset of this RowSet within the specified half-closed range of row positions.- Parameters:
startPos- The first position to included in the output (inclusive)endPos- The last position to included in the output (exclusive)- Returns:
- A new RowSet, containing only positions >= startPos and < endPos
-
subSetByKeyRange
Get a subset of this RowSet within the specified closed range of row keys.- Parameters:
startKey- The first key to include in the output.endKey- The last key (inclusive) to include in the output.- Returns:
- A new RowSet, containing only values >= startKey and <= endKey.
-
subSetForPositions
Get a subset of this RowSet according to the supplied sequence of row positions inposRowSequence.- Parameters:
posRowSequence- TheRowSequenceof positions ranges to get (as inget(long))reversed- Whether to treatposRowSetas offsets relative tosize()rather than0- Returns:
- A new RowSet, containing the row keys from this RowSet at the row positions in
posRowSequence
-
subSetForPositions
Get a subset of this RowSet according to the supplied sequence of row positions inposRowSequence.- Parameters:
posRowSequence- TheRowSequenceof position-based ranges to extract.- Returns:
- A new RowSet, containing values at the locations in the provided RowSet.
-
subSetForReversePositions
Get a subset of this RowSet according to the supplied sequence of row positions relative tosize()inposRowSequence.- Parameters:
posRowSequence- TheRowSequenceof positions ranges to get (as inget(long))- Returns:
- A new RowSet, containing the row keys from this RowSet at the row positions in
posRowSequence
-
get
long get(long rowPosition) Returns the row key at the given row position.- Parameters:
rowPosition- A row position in this RowSet between0andsize() - 1.- Returns:
- The row key at the supplied row position
-
getKeysForPositions
Returns the sequence of (increasing) keys corresponding to the positions provided as input.- Parameters:
inputPositions- an iterator providing row positions in increasing order.outputKeys- a consumer of corresponding keys for the positions provided as input.
-
find
long find(long key) Returns the position in [0..(size-1)] where the key is found. If not found, then return (-(position it would be) - 1), a la Array.binarySearch.- Parameters:
key- the key to search for- Returns:
- a position from [0..(size-1)] if the key was found. If the key was not found, then (-position - 1) as in Array.binarySearch.
-
iterator
-
searchIterator
RowSet.SearchIterator searchIterator() -
reverseIterator
RowSet.SearchIterator reverseIterator() -
rangeIterator
RowSet.RangeIterator rangeIterator() -
containsRange
boolean containsRange(long start, long end) Queries whether this RowSet contains every element in the range provided.- Parameters:
start- Start of the range, inclusive.end- End of the range, inclusive.- Returns:
- true if this RowSet contains every element x in start <= x <= end.
-
validate
-
validate
default void validate() -
isWritable
default boolean isWritable()- Returns:
- Whether this RowSet is actually
writable
-
writableCast
Cast this RowSet reference to a
WritableRowSet.- Returns:
thiscast to aWritableRowSet- Throws:
ClassCastException- Ifthisis not aWritableRowSet
-
isTracking
default boolean isTracking()- Returns:
- Whether this RowSet is actually
tracking
-
trackingCast
Cast this RowSet reference to a
TrackingRowSet.- Returns:
thiscast to aTrackingRowSet- Throws:
ClassCastException- Ifthisis not aTrackingRowSet
-