1 18 package org.apache.commons.math.function.simple; 19 20 import java.io.Serializable ; 21 22 import org.apache.commons.math.function.Compilable; 23 import org.apache.commons.math.function.Evaluation; 24 import org.apache.commons.math.function.EvaluationContext; 25 import org.apache.commons.math.function.EvaluationException; 26 27 31 public class Add implements Evaluation, Serializable { 32 33 private Evaluation left; 34 35 private Evaluation right; 36 37 public void setLeftOperand(Evaluation left) { 38 this.left = left; 39 } 40 41 public void setRightOperand(Evaluation right) { 42 this.right = right; 43 } 44 45 public Evaluation evaluate(EvaluationContext context) throws EvaluationException { 46 return context.evaluate( 47 context.doubleValue(left) + context.doubleValue(right) 48 ); 49 } 50 51 52 public String toString() { 53 return "Add"; 54 } 55 56 } | Popular Tags |