io.deephaven.engine.table.impl.sources.regioned.ColumnRegionReferencingImpl 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-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.engine.table.impl.sources.regioned;
import io.deephaven.chunk.attributes.Any;
import io.deephaven.engine.table.ChunkSource;
import io.deephaven.engine.table.GetContextMaker;
import io.deephaven.engine.table.SharedContext;
import io.deephaven.chunk.WritableChunk;
import io.deephaven.engine.page.Page;
import io.deephaven.engine.rowset.RowSequence;
import org.jetbrains.annotations.NotNull;
import javax.annotation.OverridingMethodsMustInvokeSuper;
public class ColumnRegionReferencingImpl>
implements ColumnRegionReferencing, Page.WithDefaults {
private final REFERENCED_COLUMN_REGION referencedColumnRegion;
public ColumnRegionReferencingImpl(@NotNull final REFERENCED_COLUMN_REGION referencedColumnRegion) {
this.referencedColumnRegion = referencedColumnRegion;
}
@Override
public void invalidate() {
referencedColumnRegion.invalidate();
}
@NotNull
@Override
public REFERENCED_COLUMN_REGION getReferencedRegion() {
return referencedColumnRegion;
}
@Override
public long mask() {
return getReferencedRegion().mask();
}
@Override
public void fillChunkAppend(@NotNull ChunkSource.FillContext context,
@NotNull WritableChunk super ATTR> destination, @NotNull RowSequence rowSequence) {
FillContext.converter(context).convertRegion(destination,
referencedColumnRegion.getChunk(FillContext.nativeGetContext(context), rowSequence), rowSequence);
}
@Override
@OverridingMethodsMustInvokeSuper
public void releaseCachedResources() {
ColumnRegionReferencing.super.releaseCachedResources();
referencedColumnRegion.releaseCachedResources();
}
static class FillContext implements ChunkSource.FillContext {
private final ChunkSource.GetContext nativeGetContext;
private final Converter converter;
FillContext(GetContextMaker getContextMaker, Converter converter, int chunkCapacity,
SharedContext sharedContext) {
this.converter = converter;
this.nativeGetContext = getContextMaker.makeGetContext(chunkCapacity, sharedContext);
}
static ChunkSource.GetContext nativeGetContext(ChunkSource.FillContext context) {
return ((FillContext>) context).nativeGetContext;
}
static Converter converter(ChunkSource.FillContext context) {
// noinspection unchecked
return ((FillContext) context).converter;
}
@Override
public void close() {
nativeGetContext.close();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy