io.deephaven.engine.table.iterators.ChunkedDoubleColumnIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deephaven-engine-api Show documentation
Show all versions of deephaven-engine-api Show documentation
Engine API: Engine API module, suitable as a compile-time dependency for most queries
The newest version!
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
// ****** AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY
// ****** Edit ChunkedCharacterColumnIterator and run "./gradlew replicateColumnIterators" to regenerate
//
// @formatter:off
package io.deephaven.engine.table.iterators;
// region ConsumerInterface
import java.util.function.DoubleConsumer;
// endregion ConsumerInterface
import io.deephaven.chunk.DoubleChunk;
import io.deephaven.chunk.Chunk;
import io.deephaven.chunk.ChunkType;
import io.deephaven.chunk.attributes.Any;
import io.deephaven.engine.rowset.RowSequence;
import io.deephaven.engine.table.ChunkSource;
import org.jetbrains.annotations.NotNull;
/**
* Chunked {@link DoubleColumnIterator} implementation for {@link ChunkSource chunk sources} of primitive doubles.
*/
public final class ChunkedDoubleColumnIterator
extends ChunkedColumnIterator>
implements DoubleColumnIterator {
/**
* Create a new ChunkedDoubleColumnIterator.
*
* @param chunkSource The {@link ChunkSource} to fetch values from; must have {@link ChunkSource#getChunkType()
* chunk type} of {@link ChunkType#Double}
* @param rowSequence The {@link RowSequence} to iterate over
* @param chunkSize The buffer size to use when fetching data
* @param firstRowKey The first row key from {@code rowSequence} to iterate
* @param length The total number of rows to iterate
*/
public ChunkedDoubleColumnIterator(
@NotNull final ChunkSource extends Any> chunkSource,
@NotNull final RowSequence rowSequence,
final int chunkSize,
final long firstRowKey,
final long length) {
super(validateChunkType(chunkSource, ChunkType.Double), rowSequence, chunkSize, firstRowKey, length);
}
/**
* Create a new ChunkedDoubleColumnIterator.
*
* @param chunkSource The {@link ChunkSource} to fetch values from; must have {@link ChunkSource#getChunkType()
* chunk type} of {@link ChunkType#Double}
* @param rowSequence The {@link RowSequence} to iterate over
*/
public ChunkedDoubleColumnIterator(
@NotNull final ChunkSource extends Any> chunkSource,
@NotNull final RowSequence rowSequence) {
this(chunkSource, rowSequence, DEFAULT_CHUNK_SIZE, rowSequence.firstRowKey(), rowSequence.size());
}
@Override
DoubleChunk extends Any> castChunk(@NotNull final Chunk extends Any> chunk) {
return chunk.asDoubleChunk();
}
@Override
public double nextDouble() {
maybeAdvance();
return currentData.get(currentOffset++);
}
@Override
public void forEachRemaining(@NotNull final DoubleConsumer action) {
consumeRemainingByChunks(() -> {
final int currentSize = currentData.size();
while (currentOffset < currentSize) {
action.accept(currentData.get(currentOffset++));
}
});
}
}