All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.deephaven.chunk.WritableDoubleChunkChunk Maven / Gradle / Ivy

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 WritableDoubleChunkChunk extends DoubleChunkChunk implements WritableChunkChunk {

    public static  WritableDoubleChunk[] makeArray(int capacity) {
        // noinspection unchecked
        return new WritableDoubleChunk[capacity];
    }

    public static  WritableDoubleChunkChunk makeWritableChunk(int size) {
        return writableChunkWrap(makeArray(size), 0, size);
    }

    public static  WritableDoubleChunkChunk writableChunkWrap(WritableDoubleChunk[] data) {
        return new WritableDoubleChunkChunk<>(data, 0, data.length);
    }

    public static  WritableDoubleChunkChunk writableChunkWrap(WritableDoubleChunk[] data,
            int offset, int size) {
        return new WritableDoubleChunkChunk<>(data, offset, size);
    }

    /**
     * alias of super.data, but of child type
     */
    WritableDoubleChunk[] writableData;

    WritableDoubleChunkChunk(WritableDoubleChunk[] data, int offset, int capacity) {
        super(data, offset, capacity);
        this.writableData = data;
    }

    public final void set(int index, WritableDoubleChunk value) {
        data[offset + index] = value;
        resetInnerCacheItem(index, value);
    }

    @Override
    public final WritableDoubleChunk getWritableChunk(int pos) {
        return writableData[offset + pos];
    }

    @Override
    public final void setWritableChunk(int pos, WritableChunk value) {
        set(pos, value.asWritableDoubleChunk());
    }

    public final void set(int j, int i, double value) {
        innerData[j][innerOffsets[j] + i] = value;
    }

    @Override
    public WritableDoubleChunkChunk slice(int offset, int capacity) {
        ChunkHelpers.checkSliceArgs(size, offset, capacity);
        return new WritableDoubleChunkChunk<>(writableData, this.offset + offset, capacity);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy