io.deephaven.chunk.WritableShortChunkChunk 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 WritableShortChunkChunk extends ShortChunkChunk implements WritableChunkChunk {
public static WritableShortChunk[] makeArray(int capacity) {
// noinspection unchecked
return new WritableShortChunk[capacity];
}
public static WritableShortChunkChunk makeWritableChunk(int size) {
return writableChunkWrap(makeArray(size), 0, size);
}
public static WritableShortChunkChunk writableChunkWrap(WritableShortChunk[] data) {
return new WritableShortChunkChunk<>(data, 0, data.length);
}
public static WritableShortChunkChunk writableChunkWrap(WritableShortChunk[] data,
int offset, int size) {
return new WritableShortChunkChunk<>(data, offset, size);
}
/**
* alias of super.data, but of child type
*/
WritableShortChunk[] writableData;
WritableShortChunkChunk(WritableShortChunk[] data, int offset, int capacity) {
super(data, offset, capacity);
this.writableData = data;
}
public final void set(int index, WritableShortChunk value) {
data[offset + index] = value;
resetInnerCacheItem(index, value);
}
@Override
public final WritableShortChunk getWritableChunk(int pos) {
return writableData[offset + pos];
}
@Override
public final void setWritableChunk(int pos, WritableChunk value) {
set(pos, value.asWritableShortChunk());
}
public final void set(int j, int i, short value) {
innerData[j][innerOffsets[j] + i] = value;
}
@Override
public WritableShortChunkChunk slice(int offset, int capacity) {
ChunkHelpers.checkSliceArgs(size, offset, capacity);
return new WritableShortChunkChunk<>(writableData, this.offset + offset, capacity);
}
}