KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > util > ObjectList


1 /* ========================================================================
2  * JCommon : a free general purpose class library for the Java(tm) platform
3  * ========================================================================
4  *
5  * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
6  *
7  * Project Info: http://www.jfree.org/jcommon/index.html
8  *
9  * This library is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22  * USA.
23  *
24  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
25  * in the United States and other countries.]
26  *
27  * ---------------
28  * ObjectList.java
29  * ---------------
30  * (C)opyright 2003, 2004, by Object Refinery Limited and Contributors.
31  *
32  * Original Author: David Gilbert (for Object Refinery Limited);
33  * Contributor(s): -;
34  *
35  * $Id: ObjectList.java,v 1.6 2005/11/14 10:56:42 mungady Exp $
36  *
37  * Changes
38  * -------
39  * 17-Jul-2003 : Version 1 (DG);
40  * 13-Aug-2003 : Refactored to extend AbstractObjectList (DG);
41  * 21-Oct-2004 : removed duplicate interface declarations and empty methods.
42  * 22-Oct-2004 : Restored removed methods - see note in code (DG);
43  *
44  */

45  
46 package org.jfree.util;
47
48
49 /**
50  * A list of objects that can grow as required.
51  * <p>
52  * When cloning, the objects in the list are NOT cloned, only the references.
53  *
54  * @author Thomas Morgner
55  */

56 public class ObjectList extends AbstractObjectList {
57     
58     /**
59      * Default constructor.
60      */

61     public ObjectList() {
62     }
63     
64     /**
65      * Creates a new list.
66      *
67      * @param initialCapacity the initial capacity.
68      */

69     public ObjectList(final int initialCapacity) {
70         super(initialCapacity);
71     }
72     
73     // NOTE: the methods below look redundant, but their purpose is to provide public
74
// access to the the get(), set() and indexOf() methods defined in the
75
// AbstractObjectList class, for this class only. For other classes
76
// (e.g. PaintList, ShapeList etc) we don't want the Object versions of these
77
// methods to be visible in the public API.
78

79     /**
80      * Returns the object at the specified index, if there is one, or <code>null</code>.
81      *
82      * @param index the object index.
83      *
84      * @return The object or <code>null</code>.
85      */

86     public Object JavaDoc get(final int index) {
87         return super.get(index);
88     }
89          
90     /**
91      * Sets an object reference (overwriting any existing object).
92      *
93      * @param index the object index.
94      * @param object the object (<code>null</code> permitted).
95      */

96     public void set(final int index, final Object JavaDoc object) {
97         super.set(index, object);
98     }
99          
100     /**
101      * Returns the index of the specified object, or -1 if the object is not in the list.
102      *
103      * @param object the object.
104      *
105      * @return The index or -1.
106      */

107     public int indexOf(final Object JavaDoc object) {
108         return super.indexOf(object);
109     }
110          
111 }
112
Popular Tags