Class ObjectChunk<T,ATTR extends Any>

java.lang.Object
io.deephaven.chunk.ChunkBase<ATTR>
io.deephaven.chunk.ObjectChunk<T,ATTR>
All Implemented Interfaces:
Chunk<ATTR>
Direct Known Subclasses:
ObjectChunkPage, ResettableObjectChunk, WritableObjectChunk

public class ObjectChunk<T,ATTR extends Any> extends ChunkBase<ATTR>
Chunk implementation for Object data.
  • Constructor Details

    • ObjectChunk

      protected ObjectChunk(T[] data, int offset, int capacity)
  • Method Details

    • getEmptyChunk

      public static <T, ATTR extends Any> ObjectChunk<T,ATTR> getEmptyChunk()
    • makeArray

      public static <T> T[] makeArray(int capacity)
    • chunkWrap

      public static <T, ATTR extends Any> ObjectChunk<T,ATTR> chunkWrap(T[] data)
    • chunkWrap

      public static <T, ATTR extends Any> ObjectChunk<T,ATTR> chunkWrap(T[] data, int offset, int capacity)
    • getChunkType

      public final ChunkType getChunkType()
      Returns:
      The underlying chunk type
    • get

      public final T get(int index)
    • slice

      public ObjectChunk<T,ATTR> slice(int offset, int capacity)
      Description copied from interface: Chunk
      Make a new Chunk that represents either exactly the same view on the underlying data as this Chunk, or a subrange of that view. The view is defined as [0..size) (in the coordinate space of this Chunk).
      Parameters:
      offset - Offset of the new Chunk, relative to this Chunk. 0 ≤ offset ≤ this.size
      capacity - Capacity and initial size of the new Chunk. 0 ≤ capacity ≤ this.size - offset.
      Returns:
      The new Chunk. A new Chunk will always be returned, even if the Chunks represent the same view.
    • copyToChunk

      public final void copyToChunk(int srcOffset, WritableChunk<? super ATTR> dest, int destOffset, int length)
      Description copied from interface: Chunk
      Copy a subrange of this Chunk to the subrange of the 'dest' writable chunk.
      Parameters:
      srcOffset - Starting position in 'this' (the source)
      dest - Destination writable chunk.
      destOffset - Starting offset in the destination.
      length - Number of values to copy
    • copyToArray

      public final void copyToArray(int srcOffset, Object dest, int destOffset, int length)
      Description copied from interface: Chunk
      Copy a subrange of this Chunk to the subrange of the 'dest' array.
      Parameters:
      srcOffset - Starting position in 'this' (the source)
      dest - Destination array.
      destOffset - Starting offset in the destination.
      length - Number of values to copy
    • copyToTypedArray

      public final void copyToTypedArray(int srcOffset, T[] destData, int destOffset, int length)
    • isAlias

      public final boolean isAlias(Object array)
      Returns:
      true iff this and array are aliases, that is they refer to the same underlying data
    • isAlias

      public final boolean isAlias(Chunk<?> chunk)
      Returns:
      true iff this and chunk are aliases, that is they refer to the same underlying data
    • walk

      public final <V extends Chunk.Visitor<ATTR>> V walk(V visitor)
    • asTypedObjectChunk

      public <T_DERIV extends T> ObjectChunk<T_DERIV,ATTR> asTypedObjectChunk()
    • downcast

      public static <T, ATTR extends Any, ATTR_DERIV extends ATTR> ObjectChunk<T,ATTR_DERIV> downcast(ObjectChunk<T,ATTR> self)
    • binarySearch

      public final int binarySearch(Object key)
      Search for key in this chunk in the index range [0, size) using Java's primitive ordering. This chunk must be sorted as by WritableObjectChunk.sort() prior to this call.

      This method does not compare null or NaN values according to Deephaven ordering rules.

      Parameters:
      key - The key to search for
      Returns:
      The index of the key in this chunk, or else (-(insertion point) - 1) as defined by Arrays.binarySearch(long[], long)
    • binarySearch

      public final int binarySearch(int fromIndexInclusive, int toIndexExclusive, Object key)
      Search for key in this chunk in the index range [fromIndexInclusive, toIndexExclusive) using Java's primitive ordering. This chunk must be sorted over the search index range as by WritableObjectChunk.sort(int, int) prior to this call.

      This method does not compare null or NaN values according to Deephaven ordering rules.

      Parameters:
      fromIndexInclusive - The first index to be searched
      toIndexExclusive - The index after the last index to be searched
      key - The key to search for
      Returns:
      The index of the key in this chunk, or else (-(insertion point) - 1) as defined by Arrays.binarySearch(T[], int, int, Object)