KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > corba > ContextListImpl


1 /*
2  * @(#)ContextListImpl.java 1.26 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 /*
8  * Licensed Materials - Property of IBM
9  * RMI-IIOP v1.0
10  * Copyright IBM Corp. 1998 1999 All Rights Reserved
11  *
12  * US Government Users Restricted Rights - Use, duplication or
13  * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
14  */

15
16 package com.sun.corba.se.impl.corba;
17
18 import java.util.Vector JavaDoc;
19 import org.omg.CORBA.ContextList JavaDoc;
20 import org.omg.CORBA.Bounds JavaDoc;
21 import org.omg.CORBA.ORB JavaDoc;
22
23 public class ContextListImpl extends ContextList JavaDoc
24 {
25     private final int INITIAL_CAPACITY = 2;
26     private final int CAPACITY_INCREMENT = 2;
27
28     private org.omg.CORBA.ORB JavaDoc _orb;
29     private Vector JavaDoc _contexts;
30
31     public ContextListImpl(org.omg.CORBA.ORB JavaDoc orb)
32     {
33         // Note: This orb could be an instanceof ORBSingleton or ORB
34
_orb = orb;
35         _contexts = new Vector JavaDoc(INITIAL_CAPACITY, CAPACITY_INCREMENT);
36     }
37
38     public int count()
39     {
40         return _contexts.size();
41     }
42
43     public void add(String JavaDoc ctxt)
44     {
45         _contexts.addElement(ctxt);
46     }
47
48     public String JavaDoc item(int index)
49         throws Bounds JavaDoc
50     {
51         try {
52             return (String JavaDoc) _contexts.elementAt(index);
53         } catch (ArrayIndexOutOfBoundsException JavaDoc e) {
54             throw new Bounds JavaDoc();
55         }
56     }
57
58     public void remove(int index)
59         throws Bounds JavaDoc
60     {
61         try {
62             _contexts.removeElementAt(index);
63         } catch (ArrayIndexOutOfBoundsException JavaDoc e) {
64             throw new Bounds JavaDoc();
65         }
66     }
67
68 }
69
Popular Tags