io.deephaven.engine.table.impl.sources.UngroupedBoxedShortArrayColumnSource Maven / Gradle / Ivy
Show all versions of deephaven-engine-table Show documentation
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
/*
* ---------------------------------------------------------------------------------------------------------------------
* AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY - for any changes edit UngroupedBoxedCharArrayColumnSource and regenerate
* ---------------------------------------------------------------------------------------------------------------------
*/
package io.deephaven.engine.table.impl.sources;
import io.deephaven.engine.table.ColumnSource;
import io.deephaven.engine.table.impl.MutableColumnSourceGetDefaults;
import static io.deephaven.util.QueryConstants.NULL_SHORT;
/**
* An Ungrouped Column sourced for the Boxed Type Short.
*
* The UngroupedBoxedC-harArrayColumnSource is replicated to all other types with
* io.deephaven.engine.table.impl.sources.Replicate.
*
* (C-har is deliberately spelled that way in order to prevent Replicate from altering this very comment).
*/
public class UngroupedBoxedShortArrayColumnSource extends UngroupedColumnSource implements MutableColumnSourceGetDefaults.ForObject {
private ColumnSource innerSource;
@Override
public Class> getComponentType() {
return null;
}
public UngroupedBoxedShortArrayColumnSource(ColumnSource innerSource) {
super(Short.class);
this.innerSource = innerSource;
}
@Override
public Short get(long rowKey) {
final short result = getShort(rowKey);
return (result == NULL_SHORT?null:result);
}
@Override
public short getShort(long rowKey) {
if (rowKey < 0) {
return NULL_SHORT;
}
long segment = rowKey >>base;
int offset = (int) (rowKey & ((1< = array.length || array[offset] == null) {
return NULL_SHORT;
}
return array[offset];
}
@Override
public Short getPrev(long rowKey) {
final short result = getPrevShort(rowKey);
return (result == NULL_SHORT?null:result);
}
@Override
public short getPrevShort(long rowKey) {
if (rowKey < 0) {
return NULL_SHORT;
}
long segment = rowKey >> getPrevBase();
int offset = (int) (rowKey & ((1<< getPrevBase()) - 1));
Short[] array = innerSource.getPrev(segment);
if (array == null || offset >= array.length || array[offset] == null) {
return NULL_SHORT;
}
return array[offset];
}
@Override
public boolean isImmutable() {
return innerSource.isImmutable();
}
}