io.deephaven.chunk.WritableByteChunkChunk Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deephaven-engine-chunk Show documentation
Show all versions of deephaven-engine-chunk Show documentation
Engine Chunks: Array-like data structures for dense, efficient data movement
The newest version!
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
// ****** AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY
// ****** Edit WritableCharChunkChunk and run "./gradlew replicateSourcesAndChunks" to regenerate
//
// @formatter:off
package io.deephaven.chunk;
import io.deephaven.chunk.attributes.Any;
public class WritableByteChunkChunk extends ByteChunkChunk implements WritableChunkChunk {
public static WritableByteChunk[] makeArray(int capacity) {
// noinspection unchecked
return new WritableByteChunk[capacity];
}
public static WritableByteChunkChunk makeWritableChunk(int size) {
return writableChunkWrap(makeArray(size), 0, size);
}
public static WritableByteChunkChunk writableChunkWrap(WritableByteChunk[] data) {
return new WritableByteChunkChunk<>(data, 0, data.length);
}
public static WritableByteChunkChunk writableChunkWrap(WritableByteChunk[] data,
int offset, int size) {
return new WritableByteChunkChunk<>(data, offset, size);
}
/**
* alias of super.data, but of child type
*/
WritableByteChunk[] writableData;
WritableByteChunkChunk(WritableByteChunk[] data, int offset, int capacity) {
super(data, offset, capacity);
this.writableData = data;
}
public final void set(int index, WritableByteChunk value) {
data[offset + index] = value;
resetInnerCacheItem(index, value);
}
@Override
public final WritableByteChunk getWritableChunk(int pos) {
return writableData[offset + pos];
}
@Override
public final void setWritableChunk(int pos, WritableChunk value) {
set(pos, value.asWritableByteChunk());
}
public final void set(int j, int i, byte value) {
innerData[j][innerOffsets[j] + i] = value;
}
@Override
public WritableByteChunkChunk slice(int offset, int capacity) {
ChunkHelpers.checkSliceArgs(size, offset, capacity);
return new WritableByteChunkChunk<>(writableData, this.offset + offset, capacity);
}
}