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 Power implements Evaluation, Serializable { 32 33 private Evaluation argument; 34 35 private Evaluation power; 36 37 public void setOperand(Evaluation argument) { 38 this.argument = argument; 39 } 40 41 public void setPower(Evaluation power) { 42 this.power = power; 43 } 44 45 public Evaluation evaluate(EvaluationContext context) throws EvaluationException { 46 return context.evaluate( 47 Math.pow( 48 context.doubleValue(argument), 49 context.doubleValue(power) 50 ) 51 ); 52 } 53 54 public String toString() { 55 return "Power"; 56 } 57 } | Popular Tags |