io.deephaven.engine.table.impl.sources.InstantSparseArraySource 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
*/
package io.deephaven.engine.table.impl.sources;
import io.deephaven.chunk.attributes.Values;
import io.deephaven.engine.table.impl.DefaultChunkSource;
import io.deephaven.engine.table.impl.MutableColumnSourceGetDefaults;
import io.deephaven.time.DateTimeUtils;
import org.jetbrains.annotations.NotNull;
import java.time.Instant;
/**
* Sparse Array-backed ColumnSource for {@link Instant}s. Allows reinterpret as long.
*/
public class InstantSparseArraySource extends NanosBasedTimeSparseArraySource
implements MutableColumnSourceGetDefaults.ForLongAsInstant, DefaultChunkSource, ConvertibleTimeSource {
public InstantSparseArraySource() {
super(Instant.class);
}
public InstantSparseArraySource(@NotNull final LongSparseArraySource nanoSource) {
super(Instant.class, nanoSource);
}
@Override
protected Instant makeValue(long nanos) {
return DateTimeUtils.epochNanosToInstant(nanos);
}
@Override
protected long toNanos(Instant value) {
return DateTimeUtils.epochNanos(value);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy