1 18 package org.apache.commons.math.function.simple; 19 20 import java.io.Serializable ; 21 22 import org.apache.commons.math.function.Evaluation; 23 import org.apache.commons.math.function.EvaluationContext; 24 import org.apache.commons.math.function.EvaluationException; 25 26 27 31 public class Sqrt implements Evaluation, Serializable { 32 33 private Evaluation argument; 34 35 public void setOperand(Evaluation argument) { 36 this.argument = argument; 37 } 38 39 42 public Evaluation evaluate(EvaluationContext context) throws EvaluationException { 43 return context.evaluate( 44 Math.sqrt(context.doubleValue(argument))); 45 46 } 47 48 public String toString() { 49 return "Square Root"; 50 } 51 52 } | Popular Tags |