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