KickJava   Java API By Example, From Geeks To Geeks.

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


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  * @author Gerald Brose
25  * @version $Id: ShiftExpr.java,v 1.13 2004/05/06 12:39:58 nicolas Exp $
26  */

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