Package io.deephaven.chunk
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<ATTR>,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.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.chunk.Chunk
Chunk.Visitor<ATTR extends Any> -
Field Summary
Fields inherited from interface io.deephaven.chunk.Chunk
MAXIMUM_SIZE, SYSTEM_ARRAYCOPY_THRESHOLD, SYSTEM_ARRAYFILL_THRESHOLD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidfinal voidappendTypedChunk(ObjectChunk<T, ? extends ATTR> src, int srcOffset, int length) final T[]array()Get the data array backing this WritableObjectChunk.final intGet this WritableObjectChunk's offset into the backing data array.<T_DERIV extends T>
WritableObjectChunk<T_DERIV,ATTR> voidclose()final voidcopyFromArray(Object srcArray, int srcOffset, int destOffset, int length) final voidcopyFromChunk(Chunk<? extends ATTR> src, int srcOffset, int destOffset, int length) final voidcopyFromTypedArray(T[] src, int srcOffset, int destOffset, int length) final voidcopyFromTypedChunk(ObjectChunk<T, ? extends ATTR> src, int srcOffset, int destOffset, int length) final voidfillWithBoxedValue(int offset, int size, Object value) Fill a sub-range of this writable chunk with the given value, unboxing it as appropriate.final voidfillWithNullValue(int offset, int length) Fill a sub-range of this writable chunk with the appropriate Deephaven null value for the type.final voidfillWithValue(int offset, int length, T value) static <T,ATTR extends Any>
WritableObjectChunk<T,ATTR> makeWritableChunk(int size) final voidslice(int offset, int capacity) Make a new Chunk that represents either exactly the same view on the underlying data as this Chunk, or a subrange of that view.final voidsort()Sort this chunk in place using Deephaven-defined ordering wherenull(or QueryConstants.NULL_XXXX for value types) is less than all other values and Double.NaN / Float.NaN are greater than all other values.final voidsort(int start, int length) Sort this chunk in place using Deephaven-defined ordering wherenull(or QueryConstants.NULL_XXXX for value types) is less than all other values and Double.NaN / Float.NaN are greater than all other values.static <T,ATTR extends Any, ATTR_DERIV extends ATTR>
WritableObjectChunk<T,ATTR> upcast(WritableObjectChunk<T, ATTR_DERIV> self) static <T,ATTR extends Any>
WritableObjectChunk<T,ATTR> writableChunkWrap(T[] data) static <T,ATTR extends Any>
WritableObjectChunk<T,ATTR> writableChunkWrap(T[] data, int offset, int size) Methods inherited from class io.deephaven.chunk.ObjectChunk
asTypedObjectChunk, binarySearch, binarySearch, chunkWrap, chunkWrap, copyToArray, copyToChunk, copyToTypedArray, downcast, get, getChunkType, getEmptyChunk, isAlias, isAlias, isNull, makeArray, walkMethods inherited from class io.deephaven.chunk.ChunkBase
internalCapacity, internalSetSize, sizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.deephaven.chunk.Chunk
asBooleanChunk, asByteChunk, asCharChunk, asDoubleChunk, asFloatChunk, asIntChunk, asLongChunk, asObjectChunk, asShortChunk, checkChunkType, copyToArray, copyToBuffer, copyToChunk, getChunkType, isAlias, isAlias, size, walkMethods inherited from interface io.deephaven.chunk.WritableChunk
asWritableBooleanChunk, asWritableByteChunk, asWritableCharChunk, asWritableDoubleChunk, asWritableFloatChunk, asWritableIntChunk, asWritableLongChunk, asWritableObjectChunk, asWritableShortChunk, capacity, copyFromBuffer, internalCapacity, internalSetSize, setSize
-
Constructor Details
-
WritableObjectChunk
-
-
Method Details
-
makeWritableChunk
- Parameters:
size- TheChunkBase.size()and minimum capacity of the returned chunk- Returns:
- The chunk
-
writableChunkWrap
-
writableChunkWrap
public static <T,ATTR extends Any> WritableObjectChunk<T,ATTR> writableChunkWrap(T[] data, int offset, int size) -
set
-
add
-
slice
Description copied from interface:ChunkMake 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:
slicein interfaceChunk<T>- Specified by:
slicein interfaceWritableChunk<T>- Overrides:
slicein classObjectChunk<T,ATTR extends Any> - Parameters:
offset- Offset of the new Chunk, relative to this Chunk. 0 ≤ offset ≤ this.sizecapacity- 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
Get the data array backing this WritableObjectChunk. The first element of this chunk corresponds toarray()[arrayOffset()].This WritableObjectChunk must never be
closedwhile 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 toarray()[arrayOffset()].- Returns:
- The offset into the backing data array
-
fillWithNullValue
public final void fillWithNullValue(int offset, int length) Description copied from interface:WritableChunkFill a sub-range of this writable chunk with the appropriate Deephaven null value for the type.- Specified by:
fillWithNullValuein interfaceWritableChunk<T>- Parameters:
offset- Starting offsetlength- Number of values to fill
-
fillWithBoxedValue
Description copied from interface:WritableChunkFill a sub-range of this writable chunk with the given value, unboxing it as appropriate.- Specified by:
fillWithBoxedValuein interfaceWritableChunk<T>- Parameters:
offset- Starting offsetsize- Number of values to fill
-
fillWithValue
-
appendTypedChunk
-
copyFromChunk
public final void copyFromChunk(Chunk<? extends ATTR> src, int srcOffset, int destOffset, int length) - Specified by:
copyFromChunkin interfaceWritableChunk<T>
-
copyFromTypedChunk
public final void copyFromTypedChunk(ObjectChunk<T, ? extends ATTR> src, int srcOffset, int destOffset, int length) -
copyFromArray
- Specified by:
copyFromArrayin interfaceWritableChunk<T>
-
copyFromTypedArray
-
sort
public final void sort()Description copied from interface:WritableChunkSort this chunk in place using Deephaven-defined ordering wherenull(or QueryConstants.NULL_XXXX for value types) is less than all other values and Double.NaN / Float.NaN are greater than all other values.- Specified by:
sortin interfaceWritableChunk<T>
-
sort
public final void sort(int start, int length) Description copied from interface:WritableChunkSort this chunk in place using Deephaven-defined ordering wherenull(or QueryConstants.NULL_XXXX for value types) is less than all other values and Double.NaN / Float.NaN are greater than all other values.- Specified by:
sortin interfaceWritableChunk<T>
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSafeCloseable
-
asTypedWritableObjectChunk
-
upcast
public static <T,ATTR extends Any, WritableObjectChunk<T,ATTR_DERIV extends ATTR> ATTR> upcast(WritableObjectChunk<T, ATTR_DERIV> self)
-