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

io.deephaven.engine.table.impl.updateby.minmax.ComparableCumMinMaxOperator Maven / Gradle / Ivy

There is a newer version: 0.37.1
Show newest version
package io.deephaven.engine.table.impl.updateby.minmax;

import io.deephaven.engine.table.impl.MatchPair;
import io.deephaven.engine.table.impl.updateby.internal.BaseObjectBinaryOperator;
import io.deephaven.engine.table.impl.util.RowRedirection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public final class ComparableCumMinMaxOperator> extends BaseObjectBinaryOperator {
    private final boolean isMax;

    public ComparableCumMinMaxOperator(@NotNull final MatchPair inputPair,
            final boolean isMax,
            @Nullable final RowRedirection rowRedirection,
            final Class colType) {
        super(inputPair, new String[] {inputPair.rightColumn}, rowRedirection, colType);
        this.isMax = isMax;
    }

    @Override
    protected T doOperation(T bucketCurVal, T chunkCurVal) {
        if ((isMax && chunkCurVal.compareTo(bucketCurVal) > 0) ||
                (!isMax && chunkCurVal.compareTo(bucketCurVal) < 0)) {
            return chunkCurVal;
        }

        return bucketCurVal;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy