KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > ccm > IDL3 > FileScope


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2002 USTL - LIFL - GOAL
5 Contact: openccm-team@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Philippe Merle, Mathieu Vadet.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.ccm.IDL3;
28
29 /**
30  * This class manages a FileScope object.
31  * It's used to represent declarations within an OMG IDL file.
32  *
33  * @author <a=href="Philippe.Merle@lifl.fr">Philippe Merle</a>
34  * <a=href="Mathieu.Vadet@lifl.fr">Mathieu Vadet</a>
35  *
36  * @version 0.3
37  */

38
39 public class FileScope
40        extends ScopeImpl
41 {
42     // ==================================================================
43
//
44
// Internal state.
45
//
46
// ==================================================================
47

48     /** To store included files names. */
49     protected org.objectweb.ccm.util.Vector included_files_;
50
51     // ==================================================================
52
//
53
// Constructor.
54
//
55
// ==================================================================
56

57     /**
58      ** The constructor with the parent scope and declaration tables.
59      **
60      ** @param parent The parent scope of the declaration.
61      ** @param decl The hashtable of contained declarations.
62      ** @param odecl The vector of contained declarations.
63      **/

64     public
65     FileScope(Repository rep,
66               ScopeImpl parent,
67               org.objectweb.ccm.util.Vector decls)
68     {
69         super(rep, parent);
70
71     // Init internal state.
72
contained_decls_ = decls;
73         included_files_ = new org.objectweb.ccm.util.Vector();
74     }
75
76     // ==================================================================
77
//
78
// Internal methods.
79
//
80
// ==================================================================
81

82     /**
83      ** Obtain its CORBA 3.0 Container reference.
84      **
85      ** @return The Container object associated with the
86      ** FileScope declaration.
87      **/

88     protected org.omg.CORBA.Container JavaDoc
89     getContainer()
90     {
91         return the_parent_.getContainer();
92     }
93
94     /**
95      ** Obtain its CORBA 3.0 Container reference.
96      **
97      ** @return The Container object associated with the module declaration.
98      **/

99     protected org.omg.CORBA.ComponentIR.Container
100     getComponentContainer()
101     {
102        return the_parent_.getComponentContainer();
103     }
104
105     /**
106      ** Obtain its CORBA 3.0 Contained reference.
107      **
108      ** @return null because no Contained object is associated
109      ** with the FileScope.
110      **/

111     protected org.omg.CORBA.Contained JavaDoc
112     getContained()
113     {
114         return null;
115     }
116
117     // ==================================================================
118
//
119
// Public methods for included files.
120
//
121
// ==================================================================
122

123     /**
124      ** Add an included file name to the current list.
125      **
126      ** @param fs The parent FileScope.
127      **/

128     public void
129     addIncluded(FileScope fs)
130     {
131         included_files_.add(fs);
132     }
133
134     /**
135      ** Obtain the included file names in order.
136      **
137      ** @return An array containing the included file names.
138      **/

139     public String JavaDoc[]
140     getIncluded()
141     {
142         String JavaDoc[] filenames = new String JavaDoc[included_files_.size()];
143         for (int i=0;i<filenames.length;i++)
144             filenames[i] = ((Declaration)included_files_.get(i)).getName();
145
146         return filenames;
147     }
148
149     // ==================================================================
150
//
151
// Methods for the Scope interface.
152
//
153
// ==================================================================
154

155     /**
156      ** Destroy all the contained declarations of the file scope in the IR3.
157      **/

158     public void
159     destroy()
160     {
161         // if this FileScope is the root FileScope then destroy it as a Scope.
162
if (getName().equals(""))
163             super.destroy();
164     }
165 }
166
Popular Tags