Package io.deephaven.web.shared.data
Class RangeSet
java.lang.Object
io.deephaven.web.shared.data.RangeSet
This class allows iteration over non-contiguous indexes. In the future, this will support the EcmaScript 2015
Iteration protocol, but for now has one method which returns an iterator, and also supports querying the size.
Additionally, we may add support for creating RangeSet objects to better serve some use cases.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addRangeSet
(RangeSet rangeSet) void
applyShifts
(ShiftedRange[] shiftedRanges) void
clear()
boolean
contains
(long value) copy()
static RangeSet
empty()
boolean
Removes all keys in the provided rangeset that are present in this.long
find
(long key) static RangeSet
fromSortedRanges
(Range[] sortedRanges) static RangeSet
fromSortedRanges
(List<Range> sortedRanges) long
get
(long key) long
long
int
hashCode()
boolean
includesAllOf
(RangeSet other) boolean
includesAnyOf
(Range range) boolean
isEmpty()
boolean
isFlat()
static RangeSet
ofItems
(long... items) static RangeSet
ofRange
(long first, long last) int
a new iterator over all indexes in this collection.void
removeRange
(Range range) void
removeRangeSet
(RangeSet rangeSet) long
size()
The total count of items contained in this collection.subsetForPositions
(RangeSet positions, boolean reversed) toString()
-
Constructor Details
-
RangeSet
public RangeSet()
-
-
Method Details
-
empty
-
ofRange
-
ofItems
-
fromSortedRanges
-
clear
public void clear() -
rangeIterator
a new iterator over all indexes in this collection.- Returns:
- Iterator of
Range
-
reverseRangeIterator
-
indexIterator
-
rangeCount
public int rangeCount() -
isFlat
public boolean isFlat() -
size
public long size()The total count of items contained in this collection. In some cases this can be expensive to compute, and generally should not be needed except for debugging purposes, or preallocating space (i.e., do not call this property each time through a loop).- Returns:
- long
-
isEmpty
public boolean isEmpty() -
contains
public boolean contains(long value) -
find
public long find(long key) -
toString
-
getFirstRow
public long getFirstRow() -
getLastRow
public long getLastRow() -
copy
-
equals
-
hashCode
public int hashCode() -
get
public long get(long key)
-