KickJava   Java API By Example, From Geeks To Geeks.

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


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 list of declarators.
31  *
32  * @author <a=href="Philippe.Merle@lifl.fr">Philippe Merle</a>
33  * <a=href="Mathieu.Vadet@lifl.fr">Mathieu Vadet</a>
34  *
35  * @version 0.3
36  */

37
38 public class DeclaratorList
39 {
40     // ==================================================================
41
//
42
// Internal state.
43
//
44
// ==================================================================
45

46     /**
47      ** List of declarator names.
48      **/

49     private java.util.Vector JavaDoc names_;
50
51     /**
52      ** List of declarator types.
53      **/

54     private java.util.Vector JavaDoc types_;
55
56     // ==================================================================
57
//
58
// Constructor.
59
//
60
// ==================================================================
61

62     /**
63      ** The default constructor.
64      **/

65     public DeclaratorList()
66     {
67         // Init internal state.
68
names_ = new java.util.Vector JavaDoc();
69         types_ = new java.util.Vector JavaDoc();
70     }
71
72     // ==================================================================
73
//
74
// Public methods.
75
//
76
// ==================================================================
77

78     /**
79      ** Add a declarator.
80      **
81      ** @param name The name of the declarator.
82      ** @param type The TypeRef of the declarator.
83      **/

84     public void
85     addDeclarator(String JavaDoc name,
86                   TypeRef type)
87     {
88         names_.addElement(name);
89         types_.addElement(type);
90     }
91
92     /**
93      ** Obtain the number of declarators.
94      **
95      ** @return The number of declarators.
96      **/

97     public int
98     size()
99     {
100         return names_.size();
101     }
102
103     /**
104      ** Obtain the name of the index declarator.
105      **
106      ** @param index The index of the searched declarator.
107      **
108      ** @return The name of the declarator at the specified index.
109      **/

110     public String JavaDoc
111     nameAt(int index)
112     {
113         return (String JavaDoc)names_.elementAt(index);
114     }
115
116     /**
117      ** Obtain the type of the index declarator.
118      **
119      ** @param index The index of the searched declarator.
120      **
121      ** @return The TypeRef of the declarator at the specified index.
122      **/

123     public TypeRef
124     typeAt(int index)
125     {
126         return (TypeRef)types_.elementAt(index);
127     }
128 }
129
Popular Tags