KickJava   Java API By Example, From Geeks To Geeks.

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


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 import java.io.PrintWriter JavaDoc;
24
25 /**
26  * @author Gerald Brose
27  * @version $Id: XorExpr.java,v 1.13 2004/05/06 12:39:59 nicolas Exp $
28  */

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