KickJava   Java API By Example, From Geeks To Geeks.

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


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 ValueDecl. */
30 import org.objectweb.openccm.ast.api.ValueDecl;
31
32 /** To use CORBA::ValueDef. */
33 import org.omg.CORBA.ValueDef JavaDoc;
34
35 /**
36  * ValueListImpl is a wrapper class for IDL valuetype lists.
37  *
38  *
39  * Inherits from:
40  *
41  * - ScopeListImpl: The base class for all lists of AST Scope objects.
42  *
43  * - ValueList: OMG IDL for valuetype 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 ValueListImpl
52        extends ScopeListImpl
53        implements org.objectweb.openccm.ast.api.ValueList
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     ValueListImpl()
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::ValueDefSeq.
91      *
92      * @return Its associated CORBA::ValueDefSeq.
93      */

94     protected ValueDef JavaDoc[]
95     getValueDefSeq()
96     {
97         // Create an array with the same length as the list.
98
ValueDef JavaDoc[] result = new ValueDef 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
ValueDeclImpl itf = (ValueDeclImpl)it.next();
106
107             // Obtain its associated CORBA::ExtValueDef.
108
result[i] = itf.getExtValueDef();
109         }
110
111         return result;
112     }
113
114     // ==================================================================
115
//
116
// Methods for OMG IDL org.objectweb.openccm.ast.api.ValueList
117
//
118
// ==================================================================
119

120     /**
121      * Add a ValueDecl to this list.
122      *
123      * @param value The ValueDecl to add to the list.
124      */

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

136     public ValueDecl[]
137     getValues()
138     {
139        return (ValueDecl[])super.toArray(new ValueDecl[0]);
140     }
141 }
142
Popular Tags