Interface WritableChunk<ATTR extends Attributes.Any>
- Type Parameters:
ATTR
-Attributes
that apply to this chunk
- All Superinterfaces:
AutoCloseable
,Chunk<ATTR>
,PoolableChunk
,SafeCloseable
- All Known Subinterfaces:
ResettableWritableChunk<ATTR_BASE>
- All Known Implementing Classes:
ResettableWritableBooleanChunk
,ResettableWritableByteChunk
,ResettableWritableCharChunk
,ResettableWritableDoubleChunk
,ResettableWritableFloatChunk
,ResettableWritableIntChunk
,ResettableWritableLongChunk
,ResettableWritableObjectChunk
,ResettableWritableShortChunk
,WritableBooleanChunk
,WritableByteChunk
,WritableCharChunk
,WritableDoubleChunk
,WritableFloatChunk
,WritableIntChunk
,WritableLongChunk
,WritableObjectChunk
,WritableShortChunk
public interface WritableChunk<ATTR extends Attributes.Any> extends Chunk<ATTR>, PoolableChunk
Data structure for a contiguous region of data that may be mutated.
-
Field Summary
Fields inherited from interface com.illumon.iris.db.v2.sources.chunk.Chunk
MAXIMUM_SIZE, SYSTEM_ARRAYCOPY_THRESHOLD, SYSTEM_ARRAYFILL_THRESHOLD
-
Method Summary
Modifier and Type Method Description default WritableBooleanChunk<ATTR>
asWritableBooleanChunk()
default WritableByteChunk<ATTR>
asWritableByteChunk()
default WritableCharChunk<ATTR>
asWritableCharChunk()
default WritableDoubleChunk<ATTR>
asWritableDoubleChunk()
default WritableFloatChunk<ATTR>
asWritableFloatChunk()
default WritableIntChunk<ATTR>
asWritableIntChunk()
default WritableLongChunk<ATTR>
asWritableLongChunk()
default <T> WritableObjectChunk<T,ATTR>
asWritableObjectChunk()
default WritableShortChunk<ATTR>
asWritableShortChunk()
default int
capacity()
void
copyFromArray(Object srcArray, int srcOffset, int destOffset, int length)
default void
copyFromBuffer(Buffer srcBuffer, int srcOffset, int destOffset, int length)
Fill a sub-range of this writable chunk with values from aBuffer
.void
copyFromChunk(Chunk<? extends ATTR> src, int srcOffset, int destOffset, int length)
default void
fillWithBoxedValue(int offset, int size, Object value)
Fill a sub-range of this writable chunk with the given value, unboxing it as appropriate.default void
fillWithNullValue(int offset, int size)
Fill a sub-range of this writable chunk with the appropriate Deephaven null value for the type.ChunkFiller
getChunkFiller()
Our ChunkFiller "plugin".int
internalCapacity(long password)
DO NOT CALL THIS INTERNAL METHOD.void
internalSetSize(int newSize, long password)
DO NOT CALL THIS INTERNAL METHOD.default void
setSize(int newSize)
WritableChunk<ATTR>
slice(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.void
sort()
Sort this chunk in-place using Java's primitive defined ordering.default void
sort(int start, int length)
Sort this chunk in-place using Java's primitive defined ordering.static <ATTR extends Attributes.Any, ATTR_DERIV extends ATTR>
WritableChunk<ATTR>upcast(WritableChunk<ATTR_DERIV> self)
Upcast the attribute.Methods inherited from interface com.illumon.iris.db.v2.sources.chunk.Chunk
asBooleanChunk, asByteChunk, asCharChunk, asDoubleChunk, asFloatChunk, asIntChunk, asLongChunk, asObjectChunk, asShortChunk, copyToArray, copyToBuffer, copyToChunk, getChunkType, isAlias, isAlias, size
-
Method Details
-
slice
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 interfaceChunk<ATTR extends Attributes.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.
-
fillWithNullValue
default void fillWithNullValue(int offset, int size)Fill a sub-range of this writable chunk with the appropriate Deephaven null value for the type.- Parameters:
offset
- Starting offsetsize
- Number of values to fill
-
fillWithBoxedValue
Fill a sub-range of this writable chunk with the given value, unboxing it as appropriate.- Parameters:
offset
- Starting offsetsize
- Number of values to fill
-
copyFromChunk
-
copyFromArray
-
copyFromBuffer
Fill a sub-range of this writable chunk with values from a
Buffer
. This is an optional method, as some chunk types do not have a corresponding buffer type.Implementations are free to copy data as efficiently as they may, and will use absolute rather than positional access where possible. To facilitate this pattern,
srcOffset
is an absolute offset from position 0, rather than a relative offset fromsrcBuffer.position()
.It is required that
srcBuffer.limit()
is at leastsrcOffset + length
.srcBuffer
's position may be modified, but will always be restored to its initial value upon successful return.- Parameters:
srcBuffer
- The source buffer, which will be cast to the appropriate type for this chunksrcOffset
- The offset intosrcBuffer
(from position 0, notsrcBuffer.position()
) to start copying fromdestOffset
- The offset into this chunk to start copying tolength
- The number of elements to copy
-
setSize
default void setSize(int newSize) -
internalSetSize
void internalSetSize(int newSize, long password)DO NOT CALL THIS INTERNAL METHOD. If you want to set a size, callsetSize(int)
. That method is the only legal caller of this method in the entire system. -
capacity
default int capacity() -
internalCapacity
int internalCapacity(long password)DO NOT CALL THIS INTERNAL METHOD. Callcapacity()
That method is the only legal caller of this method in the entire system. -
sort
void sort()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. -
sort
default void sort(int start, int length)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. -
getChunkFiller
ChunkFiller getChunkFiller()Our ChunkFiller "plugin". -
asWritableByteChunk
-
asWritableBooleanChunk
-
asWritableCharChunk
-
asWritableShortChunk
-
asWritableIntChunk
-
asWritableLongChunk
-
asWritableFloatChunk
-
asWritableDoubleChunk
-
asWritableObjectChunk
-
upcast
static <ATTR extends Attributes.Any, ATTR_DERIV extends ATTR> WritableChunk<ATTR> upcast(WritableChunk<ATTR_DERIV> self)Upcast the attribute. When you know the data you will receive in this chunk from another source is a more specific suptype than the source provides, you can upcast the attribute with this helper method (such as reading KeyIndices from a ColumnSource which thinks they are just Values.)- ApiNote:
- Downcast should not be necessary on WritableChunks, as a WritableChunk filling method should accept an lower bound wildcard.
-