io.deephaven.engine.table.iterators.ChunkedFloatColumnIterator 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 io.deephaven.engine.primitive.function.FloatConsumer;
// endregion ConsumerInterface
import io.deephaven.chunk.FloatChunk;
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 FloatColumnIterator} implementation for {@link ChunkSource chunk sources} of primitive floats.
*/
public final class ChunkedFloatColumnIterator
extends ChunkedColumnIterator>
implements FloatColumnIterator {
/**
* Create a new ChunkedFloatColumnIterator.
*
* @param chunkSource The {@link ChunkSource} to fetch values from; must have {@link ChunkSource#getChunkType()
* chunk type} of {@link ChunkType#Float}
* @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 ChunkedFloatColumnIterator(
@NotNull final ChunkSource extends Any> chunkSource,
@NotNull final RowSequence rowSequence,
final int chunkSize,
final long firstRowKey,
final long length) {
super(validateChunkType(chunkSource, ChunkType.Float), rowSequence, chunkSize, firstRowKey, length);
}
/**
* Create a new ChunkedFloatColumnIterator.
*
* @param chunkSource The {@link ChunkSource} to fetch values from; must have {@link ChunkSource#getChunkType()
* chunk type} of {@link ChunkType#Float}
* @param rowSequence The {@link RowSequence} to iterate over
*/
public ChunkedFloatColumnIterator(
@NotNull final ChunkSource extends Any> chunkSource,
@NotNull final RowSequence rowSequence) {
this(chunkSource, rowSequence, DEFAULT_CHUNK_SIZE, rowSequence.firstRowKey(), rowSequence.size());
}
@Override
FloatChunk extends Any> castChunk(@NotNull final Chunk extends Any> chunk) {
return chunk.asFloatChunk();
}
@Override
public float nextFloat() {
maybeAdvance();
return currentData.get(currentOffset++);
}
@Override
public void forEachRemaining(@NotNull final FloatConsumer action) {
consumeRemainingByChunks(() -> {
final int currentSize = currentData.size();
while (currentOffset < currentSize) {
action.accept(currentData.get(currentOffset++));
}
});
}
}