Class RangeSet

java.lang.Object
io.deephaven.web.shared.data.RangeSet

public class RangeSet extends Object
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 Details

    • RangeSet

      public RangeSet()
  • Method Details

    • empty

      public static RangeSet empty()
    • ofRange

      public static RangeSet ofRange(long first, long last)
    • ofItems

      public static RangeSet ofItems(long... items)
    • fromSortedRanges

      public static RangeSet fromSortedRanges(List<Range> sortedRanges)
    • fromSortedRanges

      public static RangeSet fromSortedRanges(Range[] sortedRanges)
    • addRangeSet

      public void addRangeSet(RangeSet rangeSet)
    • addRange

      public void addRange(Range range)
    • removeRangeSet

      public void removeRangeSet(RangeSet rangeSet)
    • removeRange

      public void removeRange(Range range)
    • clear

      public void clear()
    • applyShifts

      public void applyShifts(ShiftedRange[] shiftedRanges)
    • rangeIterator

      public Iterator<Range> rangeIterator()
      a new iterator over all indexes in this collection.
      Returns:
      Iterator of Range
    • reverseRangeIterator

      public Iterator<Range> reverseRangeIterator()
    • indexIterator

      public PrimitiveIterator.OfLong 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)
    • includesAllOf

      public boolean includesAllOf(RangeSet other)
    • includesAnyOf

      public boolean includesAnyOf(Range range)
    • find

      public long find(long key)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getFirstRow

      public long getFirstRow()
    • getLastRow

      public long getLastRow()
    • copy

      public RangeSet copy()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • subsetForPositions

      public RangeSet subsetForPositions(RangeSet positions, boolean reversed)
    • invert

      public RangeSet invert(RangeSet keys)
      Parameters:
      keys -
      Returns:
    • get

      public long get(long key)
    • extract

      public RangeSet extract(RangeSet other)
      Removes all keys in the provided rangeset that are present in this.
      Parameters:
      other - the rows to remove
      Returns:
      any removed keys