io.deephaven.engine.table.impl.sources.immutable.ImmutableConstantDoubleSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deephaven-engine-table Show documentation
Show all versions of deephaven-engine-table Show documentation
Engine Table: Implementation and closely-coupled utilities
/**
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending
*/
/*
* ---------------------------------------------------------------------------------------------------------------------
* AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY - for any changes edit ImmutableConstantCharSource and regenerate
* ---------------------------------------------------------------------------------------------------------------------
*/
package io.deephaven.engine.table.impl.sources.immutable;
import io.deephaven.chunk.LongChunk;
import io.deephaven.chunk.WritableDoubleChunk;
import io.deephaven.chunk.WritableChunk;
import io.deephaven.chunk.attributes.Values;
import io.deephaven.engine.rowset.RowSequence;
import io.deephaven.engine.rowset.chunkattributes.RowKeys;
import io.deephaven.engine.table.impl.AbstractColumnSource;
import io.deephaven.engine.table.impl.ImmutableColumnSourceGetDefaults;
import io.deephaven.engine.table.impl.sources.*;
import io.deephaven.engine.table.impl.util.ShiftData;
import org.jetbrains.annotations.NotNull;
import static io.deephaven.engine.rowset.RowSequence.NULL_ROW_KEY;
// region boxing imports
import static io.deephaven.util.QueryConstants.NULL_DOUBLE;
// endregion boxing imports
/**
* Constant-value immutable {@link io.deephaven.engine.table.ColumnSource} of {@code double}.
*/
public class ImmutableConstantDoubleSource
extends AbstractColumnSource
implements ImmutableColumnSourceGetDefaults.ForDouble, ShiftData.ShiftCallback, InMemoryColumnSource,
RowKeyAgnosticChunkSource /* MIXIN_IMPLS */ {
private final double value;
// region constructor
public ImmutableConstantDoubleSource(final double value) {
super(Double.class);
this.value = value;
}
// endregion constructor
@Override
public final double getDouble(final long rowKey) {
if (rowKey == NULL_ROW_KEY) {
return NULL_DOUBLE;
}
return value;
}
@Override
public final void fillChunk(
@NotNull final FillContext context,
@NotNull final WritableChunk super Values> destination,
@NotNull final RowSequence rowSequence) {
final int size = rowSequence.intSize();
destination.setSize(size);
destination.asWritableDoubleChunk().fillWithValue(0, size, value);
}
@Override
public final void fillPrevChunk(
@NotNull final FillContext context,
@NotNull final WritableChunk super Values> destination,
@NotNull final RowSequence rowSequence) {
fillChunk(context, destination, rowSequence);
}
@Override
public final void shift(final long start, final long end, final long offset) {}
@Override
public void fillChunkUnordered(
@NotNull FillContext context,
@NotNull WritableChunk super Values> dest,
@NotNull LongChunk extends RowKeys> keys) {
final WritableDoubleChunk super Values> destChunk = dest.asWritableDoubleChunk();
for (int ii = 0; ii < keys.size(); ++ii) {
destChunk.set(ii, keys.get(ii) == RowSequence.NULL_ROW_KEY ? NULL_DOUBLE : value);
}
destChunk.setSize(keys.size());
}
@Override
public void fillPrevChunkUnordered(
@NotNull FillContext context,
@NotNull WritableChunk super Values> dest,
@NotNull LongChunk extends RowKeys> keys) {
fillChunkUnordered(context , dest, keys);
}
@Override
public boolean providesFillUnordered() {
return true;
}
// region reinterpretation
// endregion reinterpretation
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy