KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > ast > lib > InterfaceListImpl


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
5 Contact: openccm@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): Christophe Demarey.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.ast.lib;
28
29 /** To use AST InterfaceDecl. */
30 import org.objectweb.openccm.ast.api.InterfaceDecl;
31
32 /** To use CORBA::InterfaceDef. */
33 import org.omg.CORBA.InterfaceDef JavaDoc;
34
35 /**
36  * InterfaceListImpl is a wrapper class for IDL interface lists.
37  *
38  *
39  * Inherits from:
40  *
41  * - ScopeListImpl: The base class for all lists of AST Scope objects.
42  *
43  * - InterfaceList: OMG IDL for interface lists.
44  *
45  *
46  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>
47  *
48  * @version 0.1
49  */

50
51 public class InterfaceListImpl
52        extends ScopeListImpl
53        implements org.objectweb.openccm.ast.api.InterfaceList
54 {
55     // ==================================================================
56
//
57
// Internal state.
58
//
59
// ==================================================================
60

61     // ==================================================================
62
//
63
// Constructor.
64
//
65
// ==================================================================
66

67     /**
68      * The default constructor.
69      */

70     public
71     InterfaceListImpl()
72     {
73         // Call the ScopeListImpl constructor.
74
super();
75     }
76
77     // ==================================================================
78
//
79
// Internal methods.
80
//
81
// ==================================================================
82

83     // ==================================================================
84
//
85
// Public methods.
86
//
87
// ==================================================================
88

89     /**
90      * Obtain its associated CORBA::InterfaceDefSeq.
91      *
92      * @return Its associated CORBA::InterfaceDefSeq.
93      */

94     public InterfaceDef JavaDoc[]
95     getInterfaceDefSeq()
96     {
97         // Create an array with the same length as the list.
98
InterfaceDef JavaDoc[] result = new InterfaceDef JavaDoc[getSize()];
99
100         // Iterate on all elements of the list.
101
java.util.Iterator JavaDoc it = iterator();
102         for(int i=0; it.hasNext(); i++)
103         {
104             // Obtain the current element.
105
InterfaceDeclImpl itf = (InterfaceDeclImpl)it.next();
106
107             // Obtain its associated CORBA::ExceptionDef.
108
result[i] = itf.getExtInterfaceDef();
109         }
110
111         // Return the array.
112
return result;
113     }
114
115     // ==================================================================
116
//
117
// Methods for OMG IDL org.objectweb.openccm.ast.api.InterfaceList
118
//
119
// ==================================================================
120

121     /**
122      * Add an InterfaceDecl to this list.
123      *
124      * @param itf The InterfaceDecl to add to the list.
125      */

126     public void
127     add(InterfaceDecl itf)
128     {
129         super.addObject(itf);
130     }
131
132     /**
133      * Obtain all the InterfaceDecl declarations added to this list.
134      *
135      * @return All the InterfaceDecl declarations added to this list.
136      */

137     public InterfaceDecl[]
138     getInterfaces()
139     {
140        return (InterfaceDecl[])super.toArray(new InterfaceDecl[0]);
141     }
142 }
143
Popular Tags