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

io.deephaven.engine.table.impl.by.alternatingcolumnsource.ByteAlternatingColumnSourceUnorderedMergeKernel Maven / Gradle / Ivy

There is a newer version: 0.37.1
Show newest version
/**
 * Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
 */
/*
 * ---------------------------------------------------------------------------------------------------------------------
 * AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY - for any changes edit CharAlternatingColumnSourceUnorderedMergeKernel and regenerate
 * ---------------------------------------------------------------------------------------------------------------------
 */
package io.deephaven.engine.table.impl.by.alternatingcolumnsource;

import io.deephaven.chunk.*;
import io.deephaven.chunk.attributes.Values;
import io.deephaven.engine.rowset.chunkattributes.RowKeys;

import static io.deephaven.engine.table.impl.by.alternatingcolumnsource.AlternatingColumnSource.ALTERNATE_SWITCH_MASK;

public class ByteAlternatingColumnSourceUnorderedMergeKernel implements AlternatingColumnSourceUnorderedMergeKernel {
    public static ByteAlternatingColumnSourceUnorderedMergeKernel INSTANCE = new ByteAlternatingColumnSourceUnorderedMergeKernel();

    // static use only
    private ByteAlternatingColumnSourceUnorderedMergeKernel() {}

    @Override
    public void mergeContext(WritableChunk dest, LongChunk outerKeys, Chunk src, int alternatePosition) {
        final WritableByteChunk destAsByte = dest.asWritableByteChunk();
        final ByteChunk srcAsByte = src.asByteChunk();

        // now merge them together
        int mainPosition = 0;
        destAsByte.setSize(outerKeys.size());
        for (int ii = 0; ii < outerKeys.size(); ++ii) {
            final long outerKey = outerKeys.get(ii);
            if ((outerKey & ALTERNATE_SWITCH_MASK) == 0) {
                destAsByte.set(ii, srcAsByte.get(mainPosition++));
            } else {
                destAsByte.set(ii, srcAsByte.get(alternatePosition++));
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy