KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > bcel > util > ClassVector


1 /*
2  * Copyright 2000-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17 package org.apache.bcel.util;
18
19 import java.util.ArrayList JavaDoc;
20 import java.util.List JavaDoc;
21 import org.apache.bcel.classfile.JavaClass;
22
23 /**
24  * Utility class implementing a (typesafe) collection of JavaClass
25  * objects. Contains the most important methods of a Vector.
26  *
27  * @version $Id: ClassVector.java 386056 2006-03-15 11:31:56Z tcurdt $
28  * @author <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
29  *
30  * @deprecated as of 5.1.1 - 7/17/2005
31  */

32 public class ClassVector implements java.io.Serializable JavaDoc {
33
34     protected List JavaDoc vec = new ArrayList JavaDoc();
35
36
37     public void addElement( JavaClass clazz ) {
38         vec.add(clazz);
39     }
40
41
42     public JavaClass elementAt( int index ) {
43         return (JavaClass) vec.get(index);
44     }
45
46
47     public void removeElementAt( int index ) {
48         vec.remove(index);
49     }
50
51
52     public JavaClass[] toArray() {
53         JavaClass[] classes = new JavaClass[vec.size()];
54         vec.toArray(classes);
55         return classes;
56     }
57 }
58
Popular Tags