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

com.samskivert.depot.impl.operator.Add Maven / Gradle / Ivy

The newest version!
//
// Depot library - a Java relational persistence library
// https://github.com/threerings/depot/blob/master/LICENSE

package com.samskivert.depot.impl.operator;

import com.samskivert.depot.expression.SQLExpression;

/**
 * The SQL '+' operator.
 */
public class Add extends Arithmetic
{
    public Add (SQLExpression column, T value)
    {
        super(column, value);
    }

    public Add (SQLExpression... values)
    {
        super(values);
    }

    @Override // from Arithmetic
    public String operator()
    {
        return "+";
    }

    @Override // from Arithmetic
    public Object evaluate (Object[] operands)
    {
        return evaluate(operands, "+", new Accumulator() {
            public Double accumulate (Double left, Double right) {
                return left + right;
            }
        }, new Accumulator() {
            public Long accumulate (Long left, Long right) {
                return left + right;
            }
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy