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 AddNode extends BinaryNode {
17:
18: public static final int ADD = 1;
19: public static final int SUBTRACT = 2;
20:
21: private int op;
22:
23: public AddNode(Node left, int op, Node right) {
24: super (left, right);
25: this .op = op;
26: }
27:
28: public int getOp() {
29: return op;
30: }
31:
32: public String getOpStr() {
33: switch (op) {
34: case ADD:
35: return "+";
36: case SUBTRACT:
37: return "-";
38: }
39: return "<? op " + op + " ?>";
40: }
41:
42: public Object arrive(NodeVisitor v, Object msg) {
43: return v.arriveAddNode(this , msg);
44: }
45:
46: public String toStringImp() {
47: return left + " " + getOpStr() + " " + right;
48: }
49:
50: }
|