01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.ejb.query;
12:
13: /**
14: * arithmetic_expression.
15: */
16: public class MultiplyNode extends BinaryNode {
17:
18: public static final int MULTIPLY = 1;
19: public static final int DIVIDE = 2;
20:
21: private Node left;
22: private int op;
23: private Node right;
24:
25: public MultiplyNode(Node left, int op, Node right) {
26: super (left, right);
27: this .op = op;
28: }
29:
30: public int getOp() {
31: return op;
32: }
33:
34: public String getOpStr() {
35: switch (op) {
36: case MULTIPLY:
37: return "*";
38: case DIVIDE:
39: return "/";
40: }
41: return "<? op " + op + " ?>";
42: }
43:
44: public Object arrive(NodeVisitor v, Object msg) {
45: return v.arriveMultiplyNode(this , msg);
46: }
47:
48: public String toStringImp() {
49: return left + " " + getOpStr() + " " + right;
50: }
51:
52: }
|