KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > idl > AndExpr


1 package org.jacorb.idl;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1997-2004 Gerald Brose.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */

22
23
24 import java.io.PrintWriter JavaDoc;
25
26 /**
27  * @author Gerald Brose
28  * @version $Id: AndExpr.java,v 1.15 2004/05/06 12:39:58 nicolas Exp $
29  */

30
31 class AndExpr
32     extends IdlSymbol
33 {
34     public AndExpr and_expr = null;
35     public ShiftExpr shift_expr;
36
37     public AndExpr(int num)
38     {
39         super(num);
40     }
41
42     public void print(PrintWriter JavaDoc ps)
43     {
44         if (and_expr != null)
45         {
46             and_expr.print(ps);
47             ps.print(" & ");
48         }
49         shift_expr.print(ps);
50     }
51
52
53     public void setDeclaration(ConstDecl declared_in)
54     {
55         shift_expr.setDeclaration(declared_in);
56     }
57
58     public void setPackage(String JavaDoc s)
59     {
60         s = parser.pack_replace(s);
61         if (pack_name.length() > 0)
62         {
63             pack_name = s + "." + pack_name;
64         }
65         else
66         {
67             pack_name = s;
68         }
69
70         if (and_expr != null)
71         {
72             and_expr.setPackage(s);
73         }
74         shift_expr.setPackage(s);
75     }
76
77     public void parse()
78     {
79         if (and_expr != null)
80         {
81             and_expr.parse();
82         }
83         shift_expr.parse();
84     }
85
86     int pos_int_const()
87     {
88         return shift_expr.pos_int_const();
89     }
90
91     public String JavaDoc value()
92     {
93         String JavaDoc x = "";
94         if (and_expr != null)
95         {
96             x = and_expr.value() + "&";
97         }
98         return x + shift_expr.value();
99     }
100
101     public String JavaDoc toString()
102     {
103         String JavaDoc x = "";
104         if (and_expr != null)
105         {
106             x = and_expr + "&";
107         }
108         return x + shift_expr;
109     }
110
111     public str_token get_token()
112     {
113         return shift_expr.get_token();
114     }
115
116 }
117
Popular Tags