package calc;

/** Summation formulas.
 * @author Gary T. Leavens
 */
public class Sum extends BinaryFormula {
    
    /**
     * Initialize this Sum object to calculate 
     * the sum of the given registers.
    */
    public Sum(int left, int right) {
        super(left, right);
    }
    
    /**
     * Evaluate the formula and return its value.
     */
    /*@ also
      @   ensures (* \result is the sum of the value of
      @              the left and right register's values. *); @*/
    public double evaluate() {
        return leftValue() + rightValue();
    }
    
    public String opString() {
         return "+";
    }
}