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

com.aerospike.jdbc.predicate.OperatorBinary Maven / Gradle / Ivy

The newest version!
package com.aerospike.jdbc.predicate;

import com.aerospike.client.exp.Exp;
import com.google.common.base.Preconditions;

import java.util.function.BinaryOperator;

public enum OperatorBinary implements Operator {

    EQ(Exp::eq),
    LT(Exp::lt),
    LE(Exp::le),
    GT(Exp::gt),
    GE(Exp::ge),
    NE((exp1, exp2) -> Exp.not(Exp.eq(exp1, exp2))),

    OR(Exp::or),
    AND(Exp::and);

    private final BinaryOperator func;

    OperatorBinary(BinaryOperator expFunc) {
        this.func = expFunc;
    }

    @Override
    public Exp exp(Exp... expressions) {
        Preconditions.checkArgument(expressions.length == 2);
        return func.apply(expressions[0], expressions[1]);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy