KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > ejb > query > AddNode


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.ejb.query;
13
14 /**
15  * arithmetic_expression.
16  */

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