package ru.yandex.webmaster3.storage.util.clickhouse2.query.methods;

/**
 * @author tsyplyaev
 */
public class SafeDivide implements Method {
    private final Object a, b;
    private final Object ifZero;

    public SafeDivide(Object a, Object b, Object ifZero) {
        this.a = a;
        this.b = b;
        this.ifZero = ifZero;
    }

    @Override
    public String toString() {
        return "(" + b.toString() + " == 0) ? " + ifZero.toString() + " : divide(" + a.toString() + ", " + b.toString() + ")";
    }
}
