001 /* ========================================================================
002 * JCommon : a free general purpose class library for the Java(tm) platform
003 * ========================================================================
004 *
005 * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
006 *
007 * Project Info: http://www.jfree.org/jcommon/index.html
008 *
009 * This library is free software; you can redistribute it and/or modify it
010 * under the terms of the GNU Lesser General Public License as published by
011 * the Free Software Foundation; either version 2.1 of the License, or
012 * (at your option) any later version.
013 *
014 * This library is distributed in the hope that it will be useful, but
015 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
016 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
017 * License for more details.
018 *
019 * You should have received a copy of the GNU Lesser General Public
020 * License along with this library; if not, write to the Free Software
021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
022 * USA.
023 *
024 * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
025 * in the United States and other countries.]
026 *
027 * ----------------
028 * BooleanList.java
029 * ----------------
030 * (C) Copyright 2003, 2004, by Object Refinery Limited.
031 *
032 * Original Author: David Gilbert (for Object Refinery Limited);
033 * Contributor(s): -;
034 *
035 * $Id: BooleanList.java,v 1.5 2005/10/18 13:24:19 mungady Exp $
036 *
037 * Changes
038 * -------
039 * 11-Jun-2003 : Version 1 (DG);
040 * 23-Jul-2003 : Renamed BooleanTable --> BooleanList and now extends
041 * ObjectList (DG);
042 * 13-Aug-2003 : Now extends new class AbstractObjectList (DG);
043 * 21-Oct-2004 : Removed duplicate implementation of Cloneable and Serializable,
044 * AbstractObjectList already implements that.
045 */
046
047 package org.jfree.util;
048
049 /**
050 * A list of <code>Boolean</code> objects.
051 *
052 * @author David Gilbert
053 */
054 public class BooleanList extends AbstractObjectList {
055
056 /** For serialization. */
057 private static final long serialVersionUID = -8543170333219422042L;
058
059 /**
060 * Creates a new list.
061 */
062 public BooleanList() {
063 }
064
065 /**
066 * Returns a {@link Boolean} from the list.
067 *
068 * @param index the index (zero-based).
069 *
070 * @return a {@link Boolean} from the list.
071 */
072 public Boolean getBoolean(final int index) {
073 return (Boolean) get(index);
074 }
075
076 /**
077 * Sets the value for an item in the list. The list is expanded if
078 * necessary.
079 *
080 * @param index the index (zero-based).
081 * @param b the boolean.
082 */
083 public void setBoolean(final int index, final Boolean b) {
084 set(index, b);
085 }
086
087 /**
088 * Tests the list for equality with another object (typically also a list).
089 *
090 * @param o the other object.
091 *
092 * @return A boolean.
093 */
094 public boolean equals(final Object o) {
095
096 if (o instanceof BooleanList) {
097 return super.equals(o);
098 }
099 return false;
100 }
101
102 /**
103 * Returns a hash code value for the object.
104 *
105 * @return the hashcode
106 */
107 public int hashCode() {
108 return super.hashCode();
109 }
110 }