Class WritableObjectChunk<T,ATTR extends Any>

java.lang.Object
io.deephaven.chunk.ChunkBase<ATTR>
io.deephaven.chunk.ObjectChunk<T,ATTR>
io.deephaven.chunk.WritableObjectChunk<T,ATTR>
All Implemented Interfaces:
Chunk<ATTR>, PoolableChunk, WritableChunk<ATTR>, SafeCloseable, AutoCloseable
Direct Known Subclasses:
ResettableWritableObjectChunk

public class WritableObjectChunk<T,ATTR extends Any> extends ObjectChunk<T,ATTR> implements WritableChunk<ATTR>
WritableChunk implementation for Object data.
  • Constructor Details

    • WritableObjectChunk

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

    • makeWritableChunk

      public static <T, ATTR extends Any> WritableObjectChunk<T,ATTR> makeWritableChunk(int size)
    • makeWritableChunkForPool

      public static <T, ATTR extends Any> WritableObjectChunk<T,ATTR> makeWritableChunkForPool(int size)
    • writableChunkWrap

      public static <T, ATTR extends Any> WritableObjectChunk<T,ATTR> writableChunkWrap(T[] data)
    • writableChunkWrap

      public static <T, ATTR extends Any> WritableObjectChunk<T,ATTR> writableChunkWrap(T[] data, int offset, int size)
    • set

      public final void set(int index, T value)
    • add

      public final void add(T value)
    • slice

      public WritableObjectChunk<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).
      Specified by:
      slice in interface Chunk<T>
      Specified by:
      slice in interface WritableChunk<T>
      Overrides:
      slice in class ObjectChunk<T,ATTR extends Any>
      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.
    • array

      public final T[] array()
      Get the data array backing this WritableObjectChunk. The first element of this chunk corresponds to array()[arrayOffset()].

      This WritableObjectChunk must never be closed while the array may be in use externally, because it must not be returned to any pool for re-use until that re-use is guaranteed to be exclusive.

      Returns:
      The backing data array
    • arrayOffset

      public final int arrayOffset()
      Get this WritableObjectChunk's offset into the backing data array. The first element of this chunk corresponds to array()[arrayOffset()].
      Returns:
      The offset into the backing data array
    • fillWithNullValue

      public final void fillWithNullValue(int offset, int length)
      Description copied from interface: WritableChunk
      Fill a sub-range of this writable chunk with the appropriate Deephaven null value for the type.
      Specified by:
      fillWithNullValue in interface WritableChunk<T>
      Parameters:
      offset - Starting offset
      length - Number of values to fill
    • fillWithBoxedValue

      public final void fillWithBoxedValue(int offset, int size, Object value)
      Description copied from interface: WritableChunk
      Fill a sub-range of this writable chunk with the given value, unboxing it as appropriate.
      Specified by:
      fillWithBoxedValue in interface WritableChunk<T>
      Parameters:
      offset - Starting offset
      size - Number of values to fill
    • fillWithValue

      public final void fillWithValue(int offset, int length, T value)
    • appendTypedChunk

      public final void appendTypedChunk(ObjectChunk<T,? extends ATTR> src, int srcOffset, int length)
    • copyFromChunk

      public final void copyFromChunk(Chunk<? extends ATTR> src, int srcOffset, int destOffset, int length)
      Specified by:
      copyFromChunk in interface WritableChunk<T>
    • copyFromTypedChunk

      public final void copyFromTypedChunk(ObjectChunk<T,? extends ATTR> src, int srcOffset, int destOffset, int length)
    • copyFromArray

      public final void copyFromArray(Object srcArray, int srcOffset, int destOffset, int length)
      Specified by:
      copyFromArray in interface WritableChunk<T>
    • copyFromTypedArray

      public final void copyFromTypedArray(T[] src, int srcOffset, int destOffset, int length)
    • sort

      public final void sort()
      Description copied from interface: WritableChunk
      Sort this chunk in-place using Java's primitive defined ordering.

      Of note is that nulls or NaNs are not sorted according to Deephaven ordering rules.

      Specified by:
      sort in interface WritableChunk<T>
    • sort

      public final void sort(int start, int length)
      Description copied from interface: WritableChunk
      Sort this chunk in-place using Java's primitive defined ordering.

      Of note is that nulls or NaNs are not sorted according to Deephaven ordering rules.

      Specified by:
      sort in interface WritableChunk<T>
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface SafeCloseable
    • asTypedWritableObjectChunk

      public <T_DERIV extends T> WritableObjectChunk<T_DERIV,ATTR> asTypedWritableObjectChunk()
    • upcast

      public static <T, ATTR extends Any, ATTR_DERIV extends ATTR> WritableObjectChunk<T,ATTR> upcast(WritableObjectChunk<T,ATTR_DERIV> self)