KickJava   Java API By Example, From Geeks To Geeks.

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


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 import java.util.Enumeration JavaDoc;
26
27 /**
28  * @author Gerald Brose
29  * @version $Id: TypeDeclarator.java,v 1.10 2004/05/06 12:39:59 nicolas Exp $
30  */

31
32 class TypeDeclarator
33         extends IdlSymbol
34 {
35
36     public TypeSpec type_spec;
37     public SymbolList declarators;
38
39     public TypeDeclarator( int num )
40     {
41         super( num );
42     }
43
44     public void setPackage( String JavaDoc s )
45     {
46         s = parser.pack_replace( s );
47         type_spec.setPackage( s );
48         for( Enumeration JavaDoc e = declarators.v.elements();
49              e.hasMoreElements(); )
50         {
51             Declarator d = (Declarator)e.nextElement();
52             d.setPackage( s );
53         }
54     }
55
56     public void parse()
57     {
58         throw new RuntimeException JavaDoc( "This method may not be used!" );
59         /*
60           declarators.parse();
61           type_spec.parse();
62         */

63     }
64
65     public TypeSpec type_spec()
66     {
67         return type_spec.typeSpec();
68     }
69
70     public String JavaDoc typeName()
71     {
72         return type_spec.typeName();
73     }
74
75     public void print( PrintWriter JavaDoc ps )
76     {
77         type_spec.print( ps );
78         for( Enumeration JavaDoc e = declarators.v.elements(); e.hasMoreElements(); )
79             ( (Declarator)e.nextElement() ).print( ps );
80     }
81
82     public void setEnclosingSymbol( IdlSymbol s )
83     {
84         enclosing_symbol = s;
85         type_spec.setEnclosingSymbol( s );
86         for( Enumeration JavaDoc e = declarators.v.elements(); e.hasMoreElements(); )
87             ( (Declarator)e.nextElement() ).setEnclosingSymbol( s );
88     }
89
90     public String JavaDoc toString()
91     {
92         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
93         sb.append( type_spec.toString() );
94         for( Enumeration JavaDoc e = declarators.v.elements(); e.hasMoreElements(); )
95             sb.append( (Declarator)e.nextElement() );
96         return sb.toString();
97     }
98
99 }
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
Popular Tags