KickJava   Java API By Example, From Geeks To Geeks.

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


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