io.deephaven.engine.table.impl.by.ssmcountdistinct.DoubleSsmBackedSource 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
*/
/*
* ---------------------------------------------------------------------------------------------------------------------
* AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY - for any changes edit CharSsmBackedSource and regenerate
* ---------------------------------------------------------------------------------------------------------------------
*/
package io.deephaven.engine.table.impl.by.ssmcountdistinct;
import io.deephaven.vector.DoubleVector;
import io.deephaven.engine.table.impl.AbstractColumnSource;
import io.deephaven.engine.table.impl.ColumnSourceGetDefaults;
import io.deephaven.engine.table.impl.MutableColumnSourceGetDefaults;
import io.deephaven.engine.table.impl.sources.ObjectArraySource;
import io.deephaven.engine.table.impl.ssms.DoubleSegmentedSortedMultiset;
import io.deephaven.engine.rowset.RowSet;
/**
* A {@link SsmBackedColumnSource} for Doubles.
*/
public class DoubleSsmBackedSource extends AbstractColumnSource
implements ColumnSourceGetDefaults.ForObject,
MutableColumnSourceGetDefaults.ForObject,
SsmBackedColumnSource {
private final ObjectArraySource underlying;
private boolean trackingPrevious = false;
//region Constructor
public DoubleSsmBackedSource() {
super(DoubleVector.class, double.class);
underlying = new ObjectArraySource<>(DoubleSegmentedSortedMultiset.class, double.class);
}
//endregion Constructor
//region SsmBackedColumnSource
@Override
public DoubleSegmentedSortedMultiset getOrCreate(long key) {
DoubleSegmentedSortedMultiset ssm = underlying.getUnsafe(key);
if(ssm == null) {
//region CreateNew
underlying.set(key, ssm = new DoubleSegmentedSortedMultiset(SsmDistinctContext.NODE_SIZE));
//endregion CreateNew
}
ssm.setTrackDeltas(trackingPrevious);
return ssm;
}
@Override
public DoubleSegmentedSortedMultiset getCurrentSsm(long key) {
return underlying.getUnsafe(key);
}
@Override
public void clear(long key) {
underlying.set(key, null);
}
@Override
public void ensureCapacity(long capacity) {
underlying.ensureCapacity(capacity);
}
@Override
public ObjectArraySource getUnderlyingSource() {
return underlying;
}
//endregion
@Override
public boolean isImmutable() {
return false;
}
@Override
public DoubleVector get(long rowKey) {
return underlying.get(rowKey);
}
@Override
public DoubleVector getPrev(long rowKey) {
final DoubleSegmentedSortedMultiset maybePrev = underlying.getPrev(rowKey);
return maybePrev == null ? null : maybePrev.getPrevValues();
}
@Override
public void startTrackingPrevValues() {
trackingPrevious = true;
underlying.startTrackingPrevValues();
}
@Override
public void clearDeltas(RowSet indices) {
indices.iterator().forEachLong(key -> {
final DoubleSegmentedSortedMultiset ssm = getCurrentSsm(key);
if(ssm != null) {
ssm.clearDeltas();
}
return true;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy