KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > orb > NVList


1 /*
2  * JacORB - a free Java ORB
3  *
4  * Copyright (C) 1997-2004 Gerald Brose.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the Free
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */

20
21 package org.jacorb.orb;
22
23 /**
24  * @author Gerald Brose, FU Berlin
25  * @version $Id: NVList.java,v 1.9 2004/05/06 12:40:00 nicolas Exp $
26  */

27
28 import java.util.*;
29
30 public class NVList
31     extends org.omg.CORBA.NVList JavaDoc
32 {
33     private Vector list;
34     private org.omg.CORBA.ORB JavaDoc orb;
35
36     NVList(org.omg.CORBA.ORB JavaDoc orb)
37     {
38     this.orb = orb;
39     list = new Vector();
40     }
41
42     NVList(org.omg.CORBA.ORB JavaDoc orb, int count)
43     {
44     this.orb = orb;
45     list = new Vector(count);
46     }
47
48     public int count()
49     {
50     return list.size();
51     }
52
53     public org.omg.CORBA.NamedValue JavaDoc add( int item_flags)
54     {
55     org.omg.CORBA.NamedValue JavaDoc nv = orb.create_named_value("", null, item_flags);
56     list.addElement( nv );
57     return nv;
58     }
59
60     public org.omg.CORBA.NamedValue JavaDoc add_item(java.lang.String JavaDoc item_name,
61                          int item_flags)
62     {
63     org.omg.CORBA.NamedValue JavaDoc nv = orb.create_named_value(item_name, null, item_flags);
64     list.addElement( nv );
65     return nv;
66     }
67
68     public org.omg.CORBA.NamedValue JavaDoc add_value(java.lang.String JavaDoc item_name,
69                           org.omg.CORBA.Any JavaDoc value,
70                           int item_flags )
71     {
72     org.omg.CORBA.NamedValue JavaDoc nv = orb.create_named_value(item_name, value, item_flags);
73     list.addElement( nv );
74     return nv;
75     }
76
77     public org.omg.CORBA.NamedValue JavaDoc item(int index)
78     throws org.omg.CORBA.Bounds JavaDoc
79     {
80     try
81     {
82         return (NamedValue)list.elementAt(index);
83     }
84     catch ( ArrayIndexOutOfBoundsException JavaDoc e )
85     {
86         throw new org.omg.CORBA.Bounds JavaDoc();
87     }
88     }
89
90     public void remove(int index)
91     throws org.omg.CORBA.Bounds JavaDoc
92     {
93     try
94     {
95         list.removeElementAt(index);
96     }
97     catch ( ArrayIndexOutOfBoundsException JavaDoc e )
98     {
99         throw new org.omg.CORBA.Bounds JavaDoc();
100     }
101     }
102
103     public java.util.Enumeration JavaDoc enumerate()
104     {
105     return list.elements();
106     }
107
108
109
110 }
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
Popular Tags