1 61 62 63 package org.jaxen.expr; 64 65 import org.jaxen.Context; 66 import org.jaxen.JaxenException; 67 import org.jaxen.function.NumberFunction; 68 69 class DefaultDivExpr extends DefaultMultiplicativeExpr 70 { 71 DefaultDivExpr(Expr lhs, 72 Expr rhs) 73 { 74 super( lhs, 75 rhs ); 76 } 77 78 public String getOperator() 79 { 80 return "div"; 81 } 82 83 public Object evaluate(Context context) throws JaxenException 84 { 85 Number lhsValue = NumberFunction.evaluate( getLHS().evaluate( context ), 86 context.getNavigator() ); 87 Number rhsValue = NumberFunction.evaluate( getRHS().evaluate( context ), 88 context.getNavigator() ); 89 90 double result = lhsValue.doubleValue() / rhsValue.doubleValue(); 91 92 return new Double ( result ); 93 } 94 public void accept(Visitor visitor) 95 { 96 visitor.visit(this); 97 } 98 } 99 | Popular Tags |