KickJava   Java API By Example, From Geeks To Geeks.

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


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

20
21 package org.jacorb.idl;
22
23 /**
24  * @author Gerald Brose
25  * @version $Id: OrExpr.java,v 1.14 2004/05/06 12:39:58 nicolas Exp $
26  */

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