KickJava   Java API By Example, From Geeks To Geeks.

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


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.
23 Contributor(s): Christophe Demarey.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.ast.lib;
28
29 /** To use AST Initializer. */
30 import org.objectweb.openccm.ast.api.Initializer;
31
32 /** To use CORBA::ExtInitializer. */
33 import org.omg.CORBA.ExtInitializer;
34
35 /**
36  * InitializerListImpl is a wrapper class
37  * for IDL valuetype initializer lists.
38  *
39  *
40  * Inherits from:
41  *
42  * - ListBaseImpl: The base class for all lists.
43  *
44  * - InitializerList: OMG IDL for valuetype initializer lists.
45  *
46  *
47  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>
48  *
49  * @version 0.1
50  */

51
52 public class InitializerListImpl
53        extends ListBaseImpl
54        implements org.objectweb.openccm.ast.api.InitializerList
55 {
56     // ==================================================================
57
//
58
// Internal state.
59
//
60
// ==================================================================
61

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

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

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

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

90     /**
91      * Obtain its associated CORBA::ExtInitializerSeq.
92      *
93      * @return Its associated CORBA::ExtInitializerSeq.
94      */

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

122     /**
123      * Add an Initializer to this list.
124      *
125      * @param init The Initializer to add to the list.
126      */

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

138     public Initializer[]
139     getInitializers()
140     {
141        return (Initializer[])super.toArray(new Initializer[0]);
142     }
143 }
144
Popular Tags