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
Modifier and TypeInterfaceDescriptionstatic interface
RowSet.Evaluator<T extends Comparable<T>>
static interface
static interface
static interface
static interface
-
Field Summary
Fields inherited from interface io.deephaven.engine.rowset.RowSequence
NULL_ROW_KEY
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
close()
Free any resources associated with this object.boolean
containsRange
(long start, long end) Queries whether this RowSet contains every element in the range provided.copy()
Make a newWritableRowSet
with the same row keys asthis
that is safe for further mutation.long
find
(long key) Returns the position in [0..(size-1)] where the key is found.long
Get the first row key in this RowSet.default void
boolean
Provide each value contained in this RowSet, in increased sorted order to the consumer.long
get
(long rowPosition) Returns the row key at the given row position.void
getKeysForPositions
(PrimitiveIterator.OfLong inputPositions, LongConsumer outputKeys) Returns the sequence of (increasing) keys corresponding to the positions provided as input.@NotNull WritableRowSet
Returns a new RowSet representing the intersection of the current RowSet with the input RowSetdefault WritableRowSet
Returns aWritableRowSet
with the row positions ofkeys
in this RowSet.Returns the row positions ofkeys
in the current set as aWritableRowSet
, stopping at maximumPosition.boolean
isEmpty()
Queries whether this RowSet is empty (i.e.default boolean
isFlat()
Returns whether or not this RowSet is flat.default boolean
Queries whether this RowSet is non-empty (i.e.default boolean
default boolean
@NotNull RowSet.Iterator
iterator()
long
Get the last row key in this RowSet.Returns a new RowSet representing the keys of the current set not present inside rowSetToRemove.boolean
Returns true if a RowSet has any overlap.boolean
overlapsRange
(long start, long end) Returns true if this RowSet has any overlap with the provided range.shift
(long shiftAmount) long
size()
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
.boolean
Returns true if this RowSet is a (possibly improper) subset of other.default void
toRowKeyArray
(long[] vs) default void
toRowKeyArray
(long[] vs, int offset) default TrackingRowSet
Cast this RowSet reference to aTrackingRowSet
.Returns a new RowSet representing the keys present in both this RowSet and the argument RowSet.default void
validate()
void
default WritableRowSet
Cast this RowSet reference to aWritableRowSet
.Methods inherited from interface io.deephaven.base.log.LogOutputAppendable
append
Methods inherited from interface io.deephaven.util.datastructures.LongSizedDataStructure
intSize, intSize
Methods 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
RowSet
methods afterclose()
is an error and may produce exceptions or undefined results.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceRowSequence
- Specified by:
close
in interfaceSafeCloseable
-
copy
WritableRowSet copy()Make a newWritableRowSet
with the same row keys asthis
that is safe for further mutation. As in other operations that return aWritableRowSet
, the result must beclosed
by 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:
size
in interfaceLongSizedDataStructure
- Specified by:
size
in 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:
isEmpty
in 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:
firstRowKey
in interfaceRowSequence
- Returns:
- The first row key, or
RowSequence.NULL_ROW_KEY
if there is none.
-
lastRowKey
long lastRowKey()Get the last row key in this RowSet.- Specified by:
lastRowKey
in interfaceRowSequence
- Returns:
- The last row key, or
RowSequence.NULL_ROW_KEY
if there is none.
-
invert
Returns a
WritableRowSet
with the row positions ofkeys
in 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
WritableRowSet
containing the positions of the keys in this RowSet
-
invert
Returns the row positions of
keys
in 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
WritableRowSet
containing 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:
forEachRowKey
in 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:
forAllRowKeys
in 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
- TheRowSequence
of positions ranges to get (as inget(long)
)reversed
- Whether to treatposRowSet
as 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
- TheRowSequence
of 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
- TheRowSequence
of 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 between0
andsize() - 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:
this
cast to aWritableRowSet
- Throws:
ClassCastException
- Ifthis
is not aWritableRowSet
-
isTracking
default boolean isTracking()- Returns:
- Whether this RowSet is actually
tracking
-
trackingCast
Cast this RowSet reference to a
TrackingRowSet
.- Returns:
this
cast to aTrackingRowSet
- Throws:
ClassCastException
- Ifthis
is not aTrackingRowSet
-