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.UpdateByOperator;
import io.deephaven.engine.table.impl.updateby.internal.BaseObjectBinaryOperator;
import org.jetbrains.annotations.NotNull;

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

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

    @Override
    public UpdateByOperator copy() {
        return new ComparableCumMinMaxOperator<>(pair, isMax, colType);
    }

    @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