Class ChunkHolderPageFloat<ATTR extends Any>

java.lang.Object
io.deephaven.generic.page.ChunkHolderPageFloat<ATTR>
All Implemented Interfaces:
Page<ATTR>, Page.WithDefaults<ATTR>, PagingChunkSource<ATTR>, ChunkSource<ATTR>, FillContextMaker, GetContextMaker, DefaultChunkSource<ATTR>, DefaultChunkSource.SupportsContiguousGet<ATTR>

public class ChunkHolderPageFloat<ATTR extends Any> extends Object implements Page.WithDefaults<ATTR>, DefaultChunkSource.SupportsContiguousGet<ATTR>
Append-only Page implementation that permanently wraps an array for data storage, atomically replacing "view" chunks with larger ones as the page is extended.
  • Constructor Details

    • ChunkHolderPageFloat

      public ChunkHolderPageFloat(long mask, long firstRow, @NotNull @org.jetbrains.annotations.NotNull float[] storage)
  • Method Details

    • getChunkType

      public final ChunkType getChunkType()
      Description copied from interface: ChunkSource
      Get the most suitable ChunkType for use with this ChunkSource.
      Specified by:
      getChunkType in interface ChunkSource<ATTR extends Any>
      Returns:
      The ChunkType
    • firstRowOffset

      public final long firstRowOffset()
      Specified by:
      firstRowOffset in interface Page<ATTR extends Any>
      Returns:
      the first row of this page, after applying the PagingChunkSource.mask(), which refers to the first row of this page.
    • maxRow

      public final long maxRow(long row)
      Description copied from interface: PagingChunkSource

      The maxRow is the greatest possible row which may reference this ChunkSource. This method is used by PagingChunkSource.fillChunkAppend(FillContext, WritableChunk, RowSequence.Iterator) to determine which of its RowSequence are referencing this PagingChunkSource.

      The default implementation assumes that only one PagingChunkSource exits for each page reference. That is, there is only one PagingChunkSource for OrderedKeys with the same bits outside of PagingChunkSource.mask().

      It is also possible to pack multiple, non-overlapping PagingChunkSources into the same page reference. In this case, one typically will want to override maxRow. An example such implementation is ChunkPage.

      Specified by:
      maxRow in interface PagingChunkSource<ATTR extends Any>
      Parameters:
      row - Any row contained on this page.
      Returns:
      the maximum last row of this page, located in the same way as row.
    • mask

      public final long mask()
      Description copied from interface: PagingChunkSource
      This mask is applied to RowSequence which are passed into ChunkSource.getChunk(ChunkSource.GetContext, RowSequence) and ChunkSource.fillChunk(ChunkSource.FillContext, WritableChunk, RowSequence). This allows the PagingChunkSources to be cached, and reused even if they are properly relocated in key space.
      Specified by:
      mask in interface PagingChunkSource<ATTR extends Any>
      Returns:
      the mask for this page, which must be a bitmask representing the some number of lower order bits of a long.
    • size

      public final int size()
      Returns:
      The current size of this page
    • get

      public final float get(long rowKey)
      Parameters:
      rowKey - The row key to retrieve the value for
      Returns:
      The value at rowKey
    • getChunk

      public final Chunk<? extends ATTR> getChunk(@NotNull @NotNull ChunkSource.GetContext context, long firstKey, long lastKey)
      Description copied from interface: ChunkSource
      Same as ChunkSource.getChunk(GetContext, RowSequence), except that you pass in the begin and last keys representing the begin and last (inclusive) keys of a single range rather than an RowSequence. Typically you want to call this only if you don't have an RowSequence, such as during an RowSequence.forAllRowKeyRanges(LongRangeConsumer) call. In this case, it allows you to avoid creating an intermediary RowSequence object.
      Specified by:
      getChunk in interface ChunkSource<ATTR extends Any>
      Specified by:
      getChunk in interface DefaultChunkSource<ATTR extends Any>
      Specified by:
      getChunk in interface DefaultChunkSource.SupportsContiguousGet<ATTR extends Any>
      Parameters:
      context - A context containing all mutable/state related data used in retrieving the Chunk. In particular, the Context may be used to provide a Chunk data pool
      firstKey - The beginning key (inclusive) of the range to fetch in the chunk
      lastKey - The last key (inclusive) of the range to fetch in the chunk
    • fillChunkAppend

      public final void fillChunkAppend(@NotNull @NotNull ChunkSource.FillContext context, @NotNull @NotNull WritableChunk<? super ATTR> destination, @NotNull @NotNull RowSequence rowSequence)
      Description copied from interface: Page.WithDefaults
      Appends the values referenced by orderKeys onto destination. orderKeys are assumed to be entirely contained on this Page.
      Specified by:
      fillChunkAppend in interface Page.WithDefaults<ATTR extends Any>
    • getSliceForAppend

      public final WritableFloatChunk<ATTR> getSliceForAppend(int expectedCurrentSize)
      Get a writable chunk slice of this page's data storage, starting at the end of the currently-visible range, to be used for appending new data.
      Parameters:
      expectedCurrentSize - The expected current size of the visible data in this page, used to assert correctness
      Returns:
      A chunk to fill with new data
    • acceptAppend

      public final void acceptAppend(@NotNull @NotNull FloatChunk<ATTR> slice, int expectedCurrentSize)
      Accept an appended slice of data to the currently-visible range for this page. Ownership of slice transfers to the callee.
      Parameters:
      slice - The slice chunk of data, which must have been returned by getSliceForAppend(int); ownership transfers to the callee
      expectedCurrentSize - The expected current size of the visible data in this page, used to assert correctness