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