All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.deephaven.engine.table.impl.sources.UngroupedBooleanArrayColumnSource Maven / Gradle / Ivy

There is a newer version: 0.37.1
Show newest version
/**
 * Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
 */
package io.deephaven.engine.table.impl.sources;

import io.deephaven.engine.table.ColumnSource;
import io.deephaven.engine.table.impl.MutableColumnSourceGetDefaults;

public class UngroupedBooleanArrayColumnSource extends UngroupedColumnSource implements MutableColumnSourceGetDefaults.ForBoolean {
    private ColumnSource innerSource;

    @Override
    public Class getComponentType() {
        return null;
    }


    public UngroupedBooleanArrayColumnSource(ColumnSource innerSource) {
        super(Boolean.class);
        this.innerSource = innerSource;
    }

    @Override
    public Boolean get(long rowKey) {
        if (rowKey < 0) {
            return null;
        }
        long segment = rowKey >>base;
        int offset = (int) (rowKey & ((1<= array.length) {
            return null;
        }
        return array[offset];
    }

    @Override
    public Boolean getPrev(long rowKey) {
        if (rowKey < 0) {
            return null;
        }
        long segment = rowKey >> getPrevBase();
        int offset = (int) (rowKey & ((1<< getPrevBase()) - 1));
        boolean[] array = innerSource.getPrev(segment);
        if(offset >= array.length) {
            return null;
        }
        return array[offset];
    }

    @Override
    public boolean isImmutable() {
        return innerSource.isImmutable();
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy