1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.jxpath.ri.compiler;
17
18 import org.apache.commons.jxpath.ri.EvalContext;
19 import org.apache.commons.jxpath.ri.InfoSetUtil;
20
21 /***
22 * Implementation of Expression for the operation "*".
23 *
24 * @author Dmitri Plotnikov
25 * @version $Revision: 1.3 $ $Date: 2004/02/29 14:17:39 $
26 */
27 public class CoreOperationMultiply extends CoreOperation {
28
29 public CoreOperationMultiply(Expression arg1, Expression arg2) {
30 super(new Expression[] { arg1, arg2 });
31 }
32
33 public Object computeValue(EvalContext context) {
34 double l = InfoSetUtil.doubleValue(args[0].computeValue(context));
35 double r = InfoSetUtil.doubleValue(args[1].computeValue(context));
36 return new Double(l * r);
37 }
38
39 protected int getPrecedence() {
40 return 5;
41 }
42
43 protected boolean isSymmetric() {
44 return true;
45 }
46
47 public String getSymbol() {
48 return "*";
49 }
50 }