package expression;

import java.math.BigDecimal;
import java.math.BigInteger;

/**
 * @author Doschennikov Nikita (me@fymio.us)
 */
public class Max extends AbstractBinaryOperation {

    public Max(AbstractExpression l, AbstractExpression r) {
        super(l, r);
    }

    @Override
    protected String getOperator() {
        return "max";
    }

    @Override
    protected int getPriority() {
        return 0;
    }

    @Override
    protected boolean isRightAssoc() {
        return false;
    }

    @Override
    protected int applyInt(int a, int b) {
        return Math.max(a, b);
    }

    @Override
    protected BigInteger applyBi(BigInteger a, BigInteger b) {
        return a.max(b);
    }

    @Override
    protected BigDecimal applyBd(BigDecimal a, BigDecimal b) {
        return a.max(b);
    }
}
