Class RspBitmapBuilderSequential

java.lang.Object
io.deephaven.engine.rowset.impl.RspBitmapBuilderSequential
All Implemented Interfaces:
OrderedLongSet.BuilderSequential, LongRangeConsumer
Direct Known Subclasses:
OrderedLongSetBuilderSequential

public class RspBitmapBuilderSequential extends Object implements OrderedLongSet.BuilderSequential
  • Field Details

    • disposable

      protected final boolean disposable
    • pendingStart

      protected long pendingStart
    • pendingEnd

      protected long pendingEnd
    • pendingContainerKey

      protected long pendingContainerKey
    • pendingContainer

      protected Container pendingContainer
    • rb

      protected RspBitmap rb
    • maxKeyHint

      protected long maxKeyHint
    • lastFlushedKey

      protected long lastFlushedKey
      The greatest key moved out of the pending range, into pendingContainer or rb, or -1 when it is not known. Order checks against rb use this rather than rb.lastValue(), which has to scan a bitmap container backward over the words past its last value.
  • Constructor Details

    • RspBitmapBuilderSequential

      public RspBitmapBuilderSequential()
    • RspBitmapBuilderSequential

      public RspBitmapBuilderSequential(boolean disposable)
  • Method Details

    • checkAndMarkBuilt

      protected final void checkAndMarkBuilt()
      Builders are single use: a second build fails instead. Only the build methods check this; appends stay unchecked to keep the hot path free of conditionals, so the effect of appending after a build is undefined rather than detected.
    • setDomain

      public void setDomain(long minRowKey, long maxRowKey)
      Specified by:
      setDomain in interface OrderedLongSet.BuilderSequential
    • getOrderedLongSet

      public OrderedLongSet getOrderedLongSet()
      Specified by:
      getOrderedLongSet in interface OrderedLongSet.BuilderSequential
    • appendKey

      public void appendKey(long rowKey)
      Specified by:
      appendKey in interface OrderedLongSet.BuilderSequential
    • appendRange

      public void appendRange(long rangeFirstRowKey, long rangeLastRowKey)
      Specified by:
      appendRange in interface OrderedLongSet.BuilderSequential
    • appendOrderedLongSet

      public void appendOrderedLongSet(long shiftAmount, OrderedLongSet ix)
      Specified by:
      appendOrderedLongSet in interface OrderedLongSet.BuilderSequential
    • commitToBitmapFor

      protected boolean commitToBitmapFor(RspBitmap ix)
      Called when ix, a bitmap whose spans could be shared, is appended before rb exists: create rb now, so that they are, or leave it and have ix appended a range at a time.

      This builder's result is a bitmap whatever it holds, so it always creates rb. A builder that can produce another representation decides whether giving that up pays.

      Returns:
      Whether rb now exists
    • appendOrderedRowKeysChunk

      public void appendOrderedRowKeysChunk(LongChunk<OrderedRowKeys> chunk, int offset, int length)
      Specified by:
      appendOrderedRowKeysChunk in interface OrderedLongSet.BuilderSequential
    • flushPendingRange

      protected void flushPendingRange()
    • flushRangeToPendingContainer

      protected void flushRangeToPendingContainer(long start, long end)
    • appendSortedRangesSizingBlocks

      protected final void appendSortedRangesSizingBlocks(SortedRanges sr)
      Append the ranges of sr, which must all come after every key this builder holds.

      Every range is already known, so rather than growing each container one range at a time -- which reallocates its backing storage as it fills, and may pass through representations it does not end in -- we walk two cursors over the ranges. One feeds ranges to the builder; the other runs ahead to the end of the block being started, so the container for it can be created at its final size and in the representation that suits it.

    • buildRsp

      public static RspBitmap buildRsp(SortedRanges sr)
      An RspBitmap holding the keys of sr, with each container created at its final size and in the representation that suits it.
    • flushPendingContainer

      protected void flushPendingContainer()