Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 96250 invoked from network); 4 Jun 2002 21:33:24 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 4 Jun 2002 21:33:24 -0000 Received: (qmail 27401 invoked by uid 97); 4 Jun 2002 21:28:28 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 27109 invoked by uid 97); 4 Jun 2002 21:28:26 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 26804 invoked by uid 97); 4 Jun 2002 21:28:24 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Date: 4 Jun 2002 16:01:29 -0000 Message-ID: <20020604160129.18913.qmail@icarus.apache.org> From: rwaldhoff@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections/primitives TestAbstractIntArrayList.java TestAbstractLongArrayList.java TestAbstractShortArrayList.java TestAll.java TestIntArrayList.java TestLongArrayList.java TestShortArrayList.java TestUnsignedByteArrayList.java TestUnsignedIntArrayList.java TestUnsignedShortArrayList.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N rwaldhoff 2002/06/04 09:01:28 Modified: collections/src/test/org/apache/commons/collections TestAll.java Added: collections/src/java/org/apache/commons/collections/primitives AbstractIntArrayList.java AbstractLongArrayList.java AbstractShortArrayList.java IntArrayList.java LongArrayList.java ShortArrayList.java UnsignedByteArrayList.java UnsignedIntArrayList.java UnsignedShortArrayList.java collections/src/test/org/apache/commons/collections/primitives TestAbstractIntArrayList.java TestAbstractLongArrayList.java TestAbstractShortArrayList.java TestAll.java TestIntArrayList.java TestLongArrayList.java TestShortArrayList.java TestUnsignedByteArrayList.java TestUnsignedIntArrayList.java TestUnsignedShortArrayList.java Log: add primitive collections, and tests Revision Changes Path 1.1 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractIntArrayList.java Index: AbstractIntArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractIntArrayList.java,v 1.1 2002/06/04 16:01:27 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:27 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import java.io.Serializable; import java.util.AbstractList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:27 $ * @author Rodney Waldhoff */ public abstract class AbstractIntArrayList extends AbstractList implements List, Serializable { //------------------------------------------------------ Abstract Accessors abstract public int capacity(); abstract public int size(); abstract public int getInt(int index); abstract public boolean containsInt(int value); abstract public int indexOfInt(int value); abstract public int lastIndexOfInt(int value); //--------------------------------------------------------------- Accessors /** Returns new Integer({@link #getInt getInteger(index)}). */ public Object get(int index) { return new Integer(getInt(index)); } /** Returns {@link #containsInt containsInt(((Integer)value).intValue())}. */ public boolean contains(Object value) { return containsInt(((Integer)value).intValue()); } /** Returns ({@link #size} == 0). */ public boolean isEmpty() { return (0 == size()); } /** Returns {@link #indexOfInt indexOfInt(((Integer)value).intValue())}. */ public int indexOf(Object value) { return indexOfInt(((Integer)value).intValue()); } /** Returns {@link #lastIndexOfInt lastIndexOfInt(((Integer)value).intValue())}. */ public int lastIndexOf(Object value) { return lastIndexOfInt(((Integer)value).intValue()); } //------------------------------------------------------ Abstract Modifiers abstract public int setInt(int index, int value); abstract public boolean addInt(int value); abstract public void addInt(int index, int value); abstract public int removeIntAt(int index); abstract public boolean removeInt(int value); abstract public void clear(); abstract public void ensureCapacity(int mincap); abstract public void trimToSize(); //--------------------------------------------------------------- Modifiers /** Returns new Integer({@link #setInt(int,int) setInt(index,((Integer)value).intValue())}). */ public Object set(int index, Object value) { return new Integer(setInt(index,((Integer)value).intValue())); } /** Invokes {@link #addInt(int) addInt(((Integer)value).intValue())}). */ public boolean add(Object value) { return addInt(((Integer)value).intValue()); } /** Invokes {@link #addInt(int,int) addInt(index,((Integer)value).intValue())}). */ public void add(int index, Object value) { addInt(index,((Integer)value).intValue()); } /** Returns new Integer({@link #removeIntAt(int) removeIntAt(index)}). */ public Object remove(int index) { return new Integer(removeIntAt(index)); } /** Returns {@link #removeInt(int) removeInt(((Integer)value).intValue())}. */ public boolean remove(Object value) { return removeInt(((Integer)value).intValue()); } } 1.1 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractLongArrayList.java Index: AbstractLongArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractLongArrayList.java,v 1.1 2002/06/04 16:01:27 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:27 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import java.io.Serializable; import java.util.AbstractList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:27 $ * @author Rodney Waldhoff */ public abstract class AbstractLongArrayList extends AbstractList implements List, Serializable { //------------------------------------------------------ Abstract Accessors abstract public int capacity(); abstract public int size(); abstract public long getLong(int index); abstract public boolean containsLong(long value); abstract public int indexOfLong(long value); abstract public int lastIndexOfLong(long value); //--------------------------------------------------------------- Accessors /** Returns new Long({@link #getLong getLong(index)}). */ public Object get(int index) { return new Long(getLong(index)); } /** Returns {@link #containsLong containsLong(((Long)value).longValue())}. */ public boolean contains(Object value) { return containsLong(((Long)value).longValue()); } /** Returns ({@link #size} == 0). */ public boolean isEmpty() { return (0 == size()); } /** Returns {@link #indexOfLong indexOfLong(((Long)value).longValue())}. */ public int indexOf(Object value) { return indexOfLong(((Long)value).longValue()); } /** Returns {@link #lastIndexOfLong lastIndexOfLong(((Long)value).longValue())}. */ public int lastIndexOf(Object value) { return lastIndexOfLong(((Long)value).longValue()); } //------------------------------------------------------ Abstract Modifiers abstract public long setLong(int index, long value); abstract public boolean addLong(long value); abstract public void addLong(int index, long value); abstract public long removeLongAt(int index); abstract public boolean removeLong(long value); abstract public void clear(); abstract public void ensureCapacity(int mincap); abstract public void trimToSize(); //--------------------------------------------------------------- Modifiers /** Returns new Long({@link #setLong(int,long) setLong(index,((Long)value).longValue())}). */ public Object set(int index, Object value) { return new Long(setLong(index,((Long)value).longValue())); } /** Invokes {@link #addLong(long) addLong(((Long)value).longValue())}). */ public boolean add(Object value) { return addLong(((Long)value).longValue()); } /** Invokes {@link #addLong(int,long) addLong(index,((Long)value).longValue())}). */ public void add(int index, Object value) { addLong(index,((Long)value).longValue()); } /** Returns new Long({@link #removeLongAt(int) removeLongAt(index)}). */ public Object remove(int index) { return new Long(removeLongAt(index)); } /** Returns {@link #removeLong(long) removeLong(((Long)value).longValue())}. */ public boolean remove(Object value) { return removeLong(((Long)value).longValue()); } } 1.1 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractShortArrayList.java Index: AbstractShortArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractShortArrayList.java,v 1.1 2002/06/04 16:01:27 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:27 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import java.io.Serializable; import java.util.AbstractList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:27 $ * @author Rodney Waldhoff */ public abstract class AbstractShortArrayList extends AbstractList implements List, Serializable { //------------------------------------------------------ Abstract Accessors abstract public int capacity(); abstract public int size(); abstract public short getShort(int index); abstract public boolean containsShort(short value); abstract public int indexOfShort(short value); abstract public int lastIndexOfShort(short value); //--------------------------------------------------------------- Accessors /** Returns new Short({@link #getShort getShort(index)}). */ public Object get(int index) { return new Short(getShort(index)); } /** Returns {@link #containsShort containsShort(((Short)value).shortValue())}. */ public boolean contains(Object value) { return containsShort(((Short)value).shortValue()); } /** Returns ({@link #size} == 0). */ public boolean isEmpty() { return (0 == size()); } /** Returns {@link #indexOfShort indexOfShort(((Short)value).shortValue())}. */ public int indexOf(Object value) { return indexOfShort(((Short)value).shortValue()); } /** Returns {@link #lastIndexOfShort lastIndexOfShort(((Short)value).shortValue())}. */ public int lastIndexOf(Object value) { return lastIndexOfShort(((Short)value).shortValue()); } //------------------------------------------------------ Abstract Modifiers abstract public short setShort(int index, short value); abstract public boolean addShort(short value); abstract public void addShort(int index, short value); abstract public short removeShortAt(int index); abstract public boolean removeShort(short value); abstract public void clear(); abstract public void ensureCapacity(int mincap); abstract public void trimToSize(); //--------------------------------------------------------------- Modifiers /** Returns new Short({@link #setShort(int,short) setShort(index,((Short)value).shortValue())}). */ public Object set(int index, Object value) { return new Short(setShort(index,((Short)value).shortValue())); } /** Invokes {@link #addShort(short) addShort(((Short)value).shortValue())}). */ public boolean add(Object value) { return addShort(((Short)value).shortValue()); } /** Invokes {@link #addShort(int,short) addShort(index,((Short)value).shortValue())}). */ public void add(int index, Object value) { addShort(index,((Short)value).shortValue()); } /** Returns new Short({@link #removeShortAt(int) removeShortAt(index)}). */ public Object remove(int index) { return new Short(removeShortAt(index)); } /** Returns {@link #removeShort(short) removeShort(((Short)value).shortValue())}. */ public boolean remove(Object value) { return removeShort(((Short)value).shortValue()); } } 1.1 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/IntArrayList.java Index: IntArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/IntArrayList.java,v 1.1 2002/06/04 16:01:27 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:27 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.AbstractList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:27 $ * @author Rodney Waldhoff */ public class IntArrayList extends AbstractIntArrayList implements List, Serializable { //------------------------------------------------------------ Constructors public IntArrayList() { this(8); } public IntArrayList(int capacity) { _data = new int[capacity]; } //--------------------------------------------------------------- Accessors public int capacity() { return _data.length; } public int size() { return _size; } public int getInt(int index) { checkRange(index); return _data[index]; } public boolean containsInt(int value) { return (-1 != indexOfInt(value)); } public int indexOfInt(int value) { for(int i=0;i<_size;i++) { if(value == _data[i]) { return i; } } return -1; } public int lastIndexOfInt(int value) { for(int i=_size-1;i>=0;i--) { if(value == _data[i]) { return i; } } return -1; } //--------------------------------------------------------------- Modifiers public int setInt(int index, int value) { checkRange(index); int old = _data[index]; _data[index] = value; return old; } public boolean addInt(int value) { ensureCapacity(_size+1); _data[_size++] = value; return true; } public void addInt(int index, int value) { checkRangeIncludingEndpoint(index); ensureCapacity(_size+1); int numtomove = _size-index; System.arraycopy(_data,index,_data,index+1,numtomove); _data[index] = value; _size++; } public void clear() { modCount++; _size = 0; } public int removeIntAt(int index) { checkRange(index); modCount++; int oldval = _data[index]; int numtomove = _size - index - 1; if(numtomove > 0) { System.arraycopy(_data,index+1,_data,index,numtomove); } _size--; return oldval; } public boolean removeInt(int value) { int index = indexOfInt(value); if(-1 == index) { return false; } else { removeIntAt(index); return true; } } public void ensureCapacity(int mincap) { modCount++; if(mincap > _data.length) { int newcap = (_data.length * 3)/2 + 1; int[] olddata = _data; _data = new int[newcap < mincap ? mincap : newcap]; System.arraycopy(olddata,0,_data,0,_size); } } public void trimToSize() { modCount++; if(_size < _data.length) { int[] olddata = _data; _data = new int[_size]; System.arraycopy(olddata,0,_data,0,_size); } } //--------------------------------------------------------------- private void writeObject(ObjectOutputStream out) throws IOException{ out.defaultWriteObject(); out.writeInt(_data.length); for(int i=0;i<_size;i++) { out.writeInt(_data[i]); } } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); _data = new int[in.readInt()]; for(int i=0;i<_size;i++) { _data[i] = in.readInt(); } } private final void checkRange(int index) { if(index < 0 || index >= _size) { throw new IndexOutOfBoundsException("Should be at least 0 and less than " + _size + ", found " + index); } } private final void checkRangeIncludingEndpoint(int index) { if(index < 0 || index > _size) { throw new IndexOutOfBoundsException("Should be at least 0 and at most " + _size + ", found " + index); } } private transient int[] _data = null; private int _size = 0; } 1.1 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/LongArrayList.java Index: LongArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/LongArrayList.java,v 1.1 2002/06/04 16:01:27 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:27 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.AbstractList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:27 $ * @author Rodney Waldhoff */ public class LongArrayList extends AbstractLongArrayList implements List, Serializable { //------------------------------------------------------------ Constructors public LongArrayList() { this(8); } public LongArrayList(int capacity) { _data = new long[capacity]; } //--------------------------------------------------------------- Accessors public int capacity() { return _data.length; } public int size() { return _size; } public long getLong(int index) { checkRange(index); return _data[index]; } public boolean containsLong(long value) { return (-1 != indexOfLong(value)); } public int indexOfLong(long value) { for(int i=0;i<_size;i++) { if(value == _data[i]) { return i; } } return -1; } public int lastIndexOfLong(long value) { for(int i=_size-1;i>=0;i--) { if(value == _data[i]) { return i; } } return -1; } //--------------------------------------------------------------- Modifiers public long setLong(int index, long value) { checkRange(index); long old = _data[index]; _data[index] = value; return old; } public boolean addLong(long value) { ensureCapacity(_size+1); _data[_size++] = value; return true; } public void addLong(int index, long value) { checkRangeIncludingEndpoint(index); ensureCapacity(_size+1); int numtomove = _size-index; System.arraycopy(_data,index,_data,index+1,numtomove); _data[index] = value; _size++; } public void add(int index, Object value) { addLong(index,((Long)value).longValue()); } public void clear() { modCount++; _size = 0; } public long removeLongAt(int index) { checkRange(index); modCount++; long oldval = _data[index]; int numtomove = _size - index - 1; if(numtomove > 0) { System.arraycopy(_data,index+1,_data,index,numtomove); } _size--; return oldval; } public boolean removeLong(long value) { int index = indexOfLong(value); if(-1 == index) { return false; } else { removeLongAt(index); return true; } } public void ensureCapacity(int mincap) { modCount++; if(mincap > _data.length) { int newcap = (_data.length * 3)/2 + 1; long[] olddata = _data; _data = new long[newcap < mincap ? mincap : newcap]; System.arraycopy(olddata,0,_data,0,_size); } } public void trimToSize() { modCount++; if(_size < _data.length) { long[] olddata = _data; _data = new long[_size]; System.arraycopy(olddata,0,_data,0,_size); } } //--------------------------------------------------------------- private void writeObject(ObjectOutputStream out) throws IOException{ out.defaultWriteObject(); out.writeInt(_data.length); for(int i=0;i<_size;i++) { out.writeLong(_data[i]); } } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); _data = new long[in.readInt()]; for(int i=0;i<_size;i++) { _data[i] = in.readLong(); } } private final void checkRange(int index) { if(index < 0 || index >= _size) { throw new IndexOutOfBoundsException("Should be at least 0 and less than " + _size + ", found " + index); } } private final void checkRangeIncludingEndpoint(int index) { if(index < 0 || index > _size) { throw new IndexOutOfBoundsException("Should be at least 0 and at most " + _size + ", found " + index); } } private transient long[] _data = null; private int _size = 0; } 1.1 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/ShortArrayList.java Index: ShortArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/ShortArrayList.java,v 1.1 2002/06/04 16:01:27 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:27 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.AbstractList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:27 $ * @author Rodney Waldhoff */ public class ShortArrayList extends AbstractShortArrayList implements List, Serializable { //------------------------------------------------------------ Constructors public ShortArrayList() { this(8); } public ShortArrayList(int capacity) { _data = new short[capacity]; } //--------------------------------------------------------------- Accessors public int capacity() { return _data.length; } public int size() { return _size; } public short getShort(int index) { checkRange(index); return _data[index]; } public boolean containsShort(short value) { return (-1 != indexOfShort(value)); } public int indexOfShort(short value) { for(int i=0;i<_size;i++) { if(value == _data[i]) { return i; } } return -1; } public int lastIndexOfShort(short value) { for(int i=_size-1;i>=0;i--) { if(value == _data[i]) { return i; } } return -1; } //--------------------------------------------------------------- Modifiers public short setShort(int index, short value) { checkRange(index); short old = _data[index]; _data[index] = value; return old; } public boolean addShort(short value) { ensureCapacity(_size+1); _data[_size++] = value; return true; } public void addShort(int index, short value) { checkRangeIncludingEndpoint(index); ensureCapacity(_size+1); int numtomove = _size-index; System.arraycopy(_data,index,_data,index+1,numtomove); _data[index] = value; _size++; } public void clear() { modCount++; _size = 0; } public short removeShortAt(int index) { checkRange(index); modCount++; short oldval = _data[index]; int numtomove = _size - index - 1; if(numtomove > 0) { System.arraycopy(_data,index+1,_data,index,numtomove); } _size--; return oldval; } public boolean removeShort(short value) { int index = indexOfShort(value); if(-1 == index) { return false; } else { removeShortAt(index); return true; } } public void ensureCapacity(int mincap) { modCount++; if(mincap > _data.length) { int newcap = (_data.length * 3)/2 + 1; short[] olddata = _data; _data = new short[newcap < mincap ? mincap : newcap]; System.arraycopy(olddata,0,_data,0,_size); } } public void trimToSize() { modCount++; if(_size < _data.length) { short[] olddata = _data; _data = new short[_size]; System.arraycopy(olddata,0,_data,0,_size); } } //--------------------------------------------------------------- private void writeObject(ObjectOutputStream out) throws IOException{ out.defaultWriteObject(); out.writeInt(_data.length); for(int i=0;i<_size;i++) { out.writeShort(_data[i]); } } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); _data = new short[in.readInt()]; for(int i=0;i<_size;i++) { _data[i] = in.readShort(); } } private final void checkRange(int index) { if(index < 0 || index >= _size) { throw new IndexOutOfBoundsException("Should be at least 0 and less than " + _size + ", found " + index); } } private final void checkRangeIncludingEndpoint(int index) { if(index < 0 || index > _size) { throw new IndexOutOfBoundsException("Should be at least 0 and at most " + _size + ", found " + index); } } private transient short[] _data = null; private int _size = 0; } 1.1 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/UnsignedByteArrayList.java Index: UnsignedByteArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/UnsignedByteArrayList.java,v 1.1 2002/06/04 16:01:27 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:27 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.AbstractList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:27 $ * @author Rodney Waldhoff */ public class UnsignedByteArrayList extends AbstractShortArrayList implements List, Serializable { //------------------------------------------------------------ Constructors public UnsignedByteArrayList() { this(8); } public UnsignedByteArrayList(int capacity) { _data = new byte[capacity]; } //--------------------------------------------------------------- Accessors public int capacity() { return _data.length; } public int size() { return _size; } public short getShort(int index) { checkRange(index); return toShort(_data[index]); } public boolean containsShort(short value) { assertValidUnsignedByte(value); return (-1 != indexOfShort(value)); } public int indexOfShort(short value) { assertValidUnsignedByte(value); int ivalue = fromShort(value); for(int i=0;i<_size;i++) { if(ivalue == _data[i]) { return i; } } return -1; } public int lastIndexOfShort(short value) { assertValidUnsignedByte(value); int ivalue = fromShort(value); for(int i=_size-1;i>=0;i--) { if(ivalue == _data[i]) { return i; } } return -1; } //--------------------------------------------------------------- Modifiers public short setShort(int index, short value) { assertValidUnsignedByte(value); checkRange(index); short old = toShort(_data[index]); _data[index] = fromShort(value); return old; } public boolean addShort(short value) { assertValidUnsignedByte(value); ensureCapacity(_size+1); _data[_size++] = fromShort(value); return true; } public void addShort(int index, short value) { assertValidUnsignedByte(value); checkRangeIncludingEndpoint(index); ensureCapacity(_size+1); int numtomove = _size-index; System.arraycopy(_data,index,_data,index+1,numtomove); _data[index] = fromShort(value); _size++; } public void clear() { modCount++; _size = 0; } public short removeShortAt(int index) { checkRange(index); modCount++; short oldval = toShort(_data[index]); int numtomove = _size - index - 1; if(numtomove > 0) { System.arraycopy(_data,index+1,_data,index,numtomove); } _size--; return oldval; } public boolean removeShort(short value) { assertValidUnsignedByte(value); int index = indexOfShort(value); if(-1 == index) { return false; } else { removeShortAt(index); return true; } } public void ensureCapacity(int mincap) { modCount++; if(mincap > _data.length) { int newcap = (_data.length * 3)/2 + 1; byte[] olddata = _data; _data = new byte[newcap < mincap ? mincap : newcap]; System.arraycopy(olddata,0,_data,0,_size); } } public void trimToSize() { modCount++; if(_size < _data.length) { byte[] olddata = _data; _data = new byte[_size]; System.arraycopy(olddata,0,_data,0,_size); } } //--------------------------------------------------------------- private final short toShort(byte value) { return (short)(((short)value)&MAX_VALUE); } private final byte fromShort(short value) { return (byte)(value&MAX_VALUE); } private final void assertValidUnsignedByte(short value) throws IllegalArgumentException { if(value > MAX_VALUE) { throw new IllegalArgumentException(value + " > " + MAX_VALUE); } if(value < MIN_VALUE) { throw new IllegalArgumentException(value + " < " + MIN_VALUE); } } private void writeObject(ObjectOutputStream out) throws IOException{ out.defaultWriteObject(); out.writeInt(_data.length); for(int i=0;i<_size;i++) { out.writeByte(_data[i]); } } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); _data = new byte[in.readInt()]; for(int i=0;i<_size;i++) { _data[i] = in.readByte(); } } private final void checkRange(int index) { if(index < 0 || index >= _size) { throw new IndexOutOfBoundsException("Should be at least 0 and less than " + _size + ", found " + index); } } private final void checkRangeIncludingEndpoint(int index) { if(index < 0 || index > _size) { throw new IndexOutOfBoundsException("Should be at least 0 and at most " + _size + ", found " + index); } } private transient byte[] _data = null; private int _size = 0; public static final short MAX_VALUE = 0xFF; public static final short MIN_VALUE = 0; } 1.1 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/UnsignedIntArrayList.java Index: UnsignedIntArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/UnsignedIntArrayList.java,v 1.1 2002/06/04 16:01:27 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:27 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.AbstractList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:27 $ * @author Rodney Waldhoff */ public class UnsignedIntArrayList extends AbstractLongArrayList implements List, Serializable { //------------------------------------------------------------ Constructors public UnsignedIntArrayList() { this(8); } public UnsignedIntArrayList(int capacity) { _data = new int[capacity]; } //--------------------------------------------------------------- Accessors public int capacity() { return _data.length; } public int size() { return _size; } public long getLong(int index) { checkRange(index); return toLong(_data[index]); } public boolean containsLong(long value) { assertValidUnsignedInt(value); return (-1 != indexOfLong(value)); } public int indexOfLong(long value) { assertValidUnsignedInt(value); int ivalue = fromLong(value); for(int i=0;i<_size;i++) { if(ivalue == _data[i]) { return i; } } return -1; } public int lastIndexOfLong(long value) { assertValidUnsignedInt(value); int ivalue = fromLong(value); for(int i=_size-1;i>=0;i--) { if(ivalue == _data[i]) { return i; } } return -1; } //--------------------------------------------------------------- Modifiers public long setLong(int index, long value) { assertValidUnsignedInt(value); checkRange(index); long old = toLong(_data[index]); _data[index] = fromLong(value); return old; } public boolean addLong(long value) { assertValidUnsignedInt(value); ensureCapacity(_size+1); _data[_size++] = fromLong(value); return true; } public void addLong(int index, long value) { assertValidUnsignedInt(value); checkRangeIncludingEndpoint(index); ensureCapacity(_size+1); int numtomove = _size-index; System.arraycopy(_data,index,_data,index+1,numtomove); _data[index] = fromLong(value); _size++; } public void clear() { modCount++; _size = 0; } public long removeLongAt(int index) { checkRange(index); modCount++; long oldval = toLong(_data[index]); int numtomove = _size - index - 1; if(numtomove > 0) { System.arraycopy(_data,index+1,_data,index,numtomove); } _size--; return oldval; } public boolean removeLong(long value) { assertValidUnsignedInt(value); int index = indexOfLong(value); if(-1 == index) { return false; } else { removeLongAt(index); return true; } } public void ensureCapacity(int mincap) { modCount++; if(mincap > _data.length) { int newcap = (_data.length * 3)/2 + 1; int[] olddata = _data; _data = new int[newcap < mincap ? mincap : newcap]; System.arraycopy(olddata,0,_data,0,_size); } } public void trimToSize() { modCount++; if(_size < _data.length) { int[] olddata = _data; _data = new int[_size]; System.arraycopy(olddata,0,_data,0,_size); } } //--------------------------------------------------------------- private final long toLong(int value) { return ((long)value)&MAX_VALUE; } private final int fromLong(long value) { return (int)(value&MAX_VALUE); } private final void assertValidUnsignedInt(long value) throws IllegalArgumentException { if(value > MAX_VALUE) { throw new IllegalArgumentException(value + " > " + MAX_VALUE); } if(value < MIN_VALUE) { throw new IllegalArgumentException(value + " < " + MIN_VALUE); } } private void writeObject(ObjectOutputStream out) throws IOException{ out.defaultWriteObject(); out.writeInt(_data.length); for(int i=0;i<_size;i++) { out.writeInt(_data[i]); } } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); _data = new int[in.readInt()]; for(int i=0;i<_size;i++) { _data[i] = in.readInt(); } } private final void checkRange(int index) { if(index < 0 || index >= _size) { throw new IndexOutOfBoundsException("Should be at least 0 and less than " + _size + ", found " + index); } } private final void checkRangeIncludingEndpoint(int index) { if(index < 0 || index > _size) { throw new IndexOutOfBoundsException("Should be at least 0 and at most " + _size + ", found " + index); } } private transient int[] _data = null; private int _size = 0; public static final long MAX_VALUE = 0xFFFFFFFFL; public static final long MIN_VALUE = 0L; } 1.1 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/UnsignedShortArrayList.java Index: UnsignedShortArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/UnsignedShortArrayList.java,v 1.1 2002/06/04 16:01:27 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:27 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.AbstractList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:27 $ * @author Rodney Waldhoff */ public class UnsignedShortArrayList extends AbstractIntArrayList implements List, Serializable { //------------------------------------------------------------ Constructors public UnsignedShortArrayList() { this(8); } public UnsignedShortArrayList(int capacity) { _data = new short[capacity]; } //--------------------------------------------------------------- Accessors public int capacity() { return _data.length; } public int size() { return _size; } public int getInt(int index) { checkRange(index); return toInt(_data[index]); } public boolean containsInt(int value) { assertValidUnsignedShort(value); return (-1 != indexOfInt(value)); } public int indexOfInt(int value) { assertValidUnsignedShort(value); int ivalue = fromInt(value); for(int i=0;i<_size;i++) { if(ivalue == _data[i]) { return i; } } return -1; } public int lastIndexOfInt(int value) { assertValidUnsignedShort(value); int ivalue = fromInt(value); for(int i=_size-1;i>=0;i--) { if(ivalue == _data[i]) { return i; } } return -1; } //--------------------------------------------------------------- Modifiers public int setInt(int index, int value) { assertValidUnsignedShort(value); checkRange(index); int old = toInt(_data[index]); _data[index] = fromInt(value); return old; } public boolean addInt(int value) { assertValidUnsignedShort(value); ensureCapacity(_size+1); _data[_size++] = fromInt(value); return true; } public void addInt(int index, int value) { assertValidUnsignedShort(value); checkRangeIncludingEndpoint(index); ensureCapacity(_size+1); int numtomove = _size-index; System.arraycopy(_data,index,_data,index+1,numtomove); _data[index] = fromInt(value); _size++; } public void clear() { modCount++; _size = 0; } public int removeIntAt(int index) { checkRange(index); modCount++; int oldval = toInt(_data[index]); int numtomove = _size - index - 1; if(numtomove > 0) { System.arraycopy(_data,index+1,_data,index,numtomove); } _size--; return oldval; } public boolean removeInt(int value) { assertValidUnsignedShort(value); int index = indexOfInt(value); if(-1 == index) { return false; } else { removeIntAt(index); return true; } } public void ensureCapacity(int mincap) { modCount++; if(mincap > _data.length) { int newcap = (_data.length * 3)/2 + 1; short[] olddata = _data; _data = new short[newcap < mincap ? mincap : newcap]; System.arraycopy(olddata,0,_data,0,_size); } } public void trimToSize() { modCount++; if(_size < _data.length) { short[] olddata = _data; _data = new short[_size]; System.arraycopy(olddata,0,_data,0,_size); } } //--------------------------------------------------------------- private final int toInt(short value) { return ((int)value)&MAX_VALUE; } private final short fromInt(int value) { return (short)(value&MAX_VALUE); } private final void assertValidUnsignedShort(int value) throws IllegalArgumentException { if(value > MAX_VALUE) { throw new IllegalArgumentException(value + " > " + MAX_VALUE); } if(value < MIN_VALUE) { throw new IllegalArgumentException(value + " < " + MIN_VALUE); } } private void writeObject(ObjectOutputStream out) throws IOException{ out.defaultWriteObject(); out.writeInt(_data.length); for(int i=0;i<_size;i++) { out.writeShort(_data[i]); } } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); _data = new short[in.readInt()]; for(int i=0;i<_size;i++) { _data[i] = in.readShort(); } } private final void checkRange(int index) { if(index < 0 || index >= _size) { throw new IndexOutOfBoundsException("Should be at least 0 and less than " + _size + ", found " + index); } } private final void checkRangeIncludingEndpoint(int index) { if(index < 0 || index > _size) { throw new IndexOutOfBoundsException("Should be at least 0 and at most " + _size + ", found " + index); } } private transient short[] _data = null; private int _size = 0; public static final int MAX_VALUE = 0xFFFF; public static final int MIN_VALUE = 0; } 1.26 +5 -4 jakarta-commons/collections/src/test/org/apache/commons/collections/TestAll.java Index: TestAll.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestAll.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- TestAll.java 10 Apr 2002 16:33:23 -0000 1.25 +++ TestAll.java 4 Jun 2002 16:01:27 -0000 1.26 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestAll.java,v 1.25 2002/04/10 16:33:23 morgand Exp $ - * $Revision: 1.25 $ - * $Date: 2002/04/10 16:33:23 $ + * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestAll.java,v 1.26 2002/06/04 16:01:27 rwaldhoff Exp $ + * $Revision: 1.26 $ + * $Date: 2002/06/04 16:01:27 $ * * ==================================================================== * @@ -67,7 +67,7 @@ /** * Entry point for all Collections tests. * @author Rodney Waldhoff - * @version $Id: TestAll.java,v 1.25 2002/04/10 16:33:23 morgand Exp $ + * @version $Id: TestAll.java,v 1.26 2002/06/04 16:01:27 rwaldhoff Exp $ */ public class TestAll extends TestCase { public TestAll(String testName) { @@ -105,6 +105,7 @@ suite.addTest(TestSingletonIterator.suite()); suite.addTest(TestTreeBag.suite()); suite.addTest(TestUniqueFilterIterator.suite()); + suite.addTest(org.apache.commons.collections.primitives.TestAll.suite()); return suite; } 1.1 jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestAbstractIntArrayList.java Index: TestAbstractIntArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestAbstractIntArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:28 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import org.apache.commons.collections.TestList; import java.util.List; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ * @author Rodney Waldhoff */ public abstract class TestAbstractIntArrayList extends /* TestList */ TestCase { //------------------------------------------------------------ Conventional public TestAbstractIntArrayList(String testName) { super(testName); } //---------------------------------------------------------------- Abstract abstract protected AbstractIntArrayList createList(); //------------------------------------------------------- TestList interface public List makeEmptyList() { return createList(); } //------------------------------------------------------------------- Tests public void testAddGet() { AbstractIntArrayList list = createList(); for(int i=0;i<1000;i++) { list.addInt(i); } for(int i=0;i<1000;i++) { assertEquals(i,list.getInt(i)); } } public void testAddGetLargeValues() { AbstractIntArrayList list = createList(); for(int i=0;i<1000;i++) { int value = ((int)(Short.MAX_VALUE)); value += i; list.addInt(value); } for(int i=0;i<1000;i++) { int value = ((int)(Short.MAX_VALUE)); value += i; assertEquals(value,list.getInt(i)); } } public void testAddAndShift() { AbstractIntArrayList list = createList(); list.addInt(0, 1); assertEquals("Should have one entry", 1, list.size()); list.addInt(3); list.addInt(4); list.addInt(1, 2); for (int i = 0; i < 4; i++) { assertEquals("Should get entry back", i + 1, list.getInt(i)); } list.addInt(0, 0); for (int i = 0; i < 5; i++) { assertEquals("Should get entry back", i, list.getInt(i)); } } } 1.1 jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestAbstractLongArrayList.java Index: TestAbstractLongArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestAbstractLongArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:28 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import org.apache.commons.collections.TestList; import java.util.List; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ * @author Rodney Waldhoff */ public abstract class TestAbstractLongArrayList extends /* TestList */ TestCase { //------------------------------------------------------------ Conventional public TestAbstractLongArrayList(String testName) { super(testName); } //---------------------------------------------------------------- Abstract abstract protected AbstractLongArrayList createList(); //------------------------------------------------------- TestList interface public List makeEmptyList() { return createList(); } //------------------------------------------------------------------- Tests public void testAddGet() { AbstractLongArrayList list = createList(); for(long i=0L;i<1000L;i++) { list.addLong(i); } for(int i=0;i<1000;i++) { assertEquals((long)i,list.getLong(i)); } } public void testAddGetLargeValues() { AbstractLongArrayList list = createList(); for(long i=0L;i<1000L;i++) { long value = ((long)(Integer.MAX_VALUE)); value += i; list.addLong(value); } for(long i=0L;i<1000L;i++) { long value = ((long)(Integer.MAX_VALUE)); value += i; assertEquals(value,list.getLong((int)i)); } } } 1.1 jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestAbstractShortArrayList.java Index: TestAbstractShortArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestAbstractShortArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:28 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import org.apache.commons.collections.TestList; import java.util.List; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ * @author Rodney Waldhoff */ public abstract class TestAbstractShortArrayList extends /* TestList */ TestCase { //------------------------------------------------------------ Conventional public TestAbstractShortArrayList(String testName) { super(testName); } //---------------------------------------------------------------- Abstract abstract protected AbstractShortArrayList createList(); //------------------------------------------------------- TestList interface public List makeEmptyList() { return createList(); } //------------------------------------------------------------------- Tests public void testAddGet() { AbstractShortArrayList list = createList(); for(short i=0;i<100;i++) { list.addShort(i); } for(int i=0;i<100;i++) { assertEquals((short)i,list.getShort(i)); } } public void testAddGetLargeValues() { AbstractShortArrayList list = createList(); for(short i=128;i<256;i++) { list.addShort(i); } for(int i=0;i<128;i++) { assertEquals((short)(i+128),list.getShort(i)); } } } 1.1 jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestAll.java Index: TestAll.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestAll.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:28 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ * @author Rodney Waldhoff */ public class TestAll extends TestCase { public TestAll(String testName) { super(testName); } public static void main(String args[]) { String[] testCaseName = { TestAll.class.getName() }; junit.textui.TestRunner.main(testCaseName); } public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(TestUnsignedByteArrayList.suite()); suite.addTest(TestShortArrayList.suite()); suite.addTest(TestUnsignedShortArrayList.suite()); suite.addTest(TestIntArrayList.suite()); suite.addTest(TestUnsignedIntArrayList.suite()); suite.addTest(TestLongArrayList.suite()); return suite; } } 1.1 jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestIntArrayList.java Index: TestIntArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestIntArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:28 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ * @author Rodney Waldhoff */ public class TestIntArrayList extends TestAbstractIntArrayList { //------------------------------------------------------------ Conventional public TestIntArrayList(String testName) { super(testName); } public static Test suite() { TestSuite suite = new TestSuite(TestIntArrayList.class); return suite; } //---------------------------------------------------------------- Abstract protected AbstractIntArrayList createList() { return new IntArrayList(); } } 1.1 jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestLongArrayList.java Index: TestLongArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestLongArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:28 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ * @author Rodney Waldhoff */ public class TestLongArrayList extends TestAbstractLongArrayList { //------------------------------------------------------------ Conventional public TestLongArrayList(String testName) { super(testName); } public static Test suite() { TestSuite suite = new TestSuite(TestLongArrayList.class); return suite; } //---------------------------------------------------------- Abstract Impls protected AbstractLongArrayList createList() { return new LongArrayList(); } } 1.1 jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestShortArrayList.java Index: TestShortArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestShortArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:28 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ * @author Rodney Waldhoff */ public class TestShortArrayList extends TestAbstractShortArrayList { //------------------------------------------------------------ Conventional public TestShortArrayList(String testName) { super(testName); } public static Test suite() { TestSuite suite = new TestSuite(TestShortArrayList.class); return suite; } //---------------------------------------------------------------- Abstract protected AbstractShortArrayList createList() { return new ShortArrayList(); } } 1.1 jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestUnsignedByteArrayList.java Index: TestUnsignedByteArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestUnsignedByteArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:28 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ * @author Rodney Waldhoff */ public class TestUnsignedByteArrayList extends TestAbstractShortArrayList { //------------------------------------------------------------ Conventional public TestUnsignedByteArrayList(String testName) { super(testName); } public static Test suite() { TestSuite suite = new TestSuite(TestUnsignedByteArrayList.class); return suite; } //---------------------------------------------------------------- Abstract protected AbstractShortArrayList createList() { return new UnsignedByteArrayList(); } } 1.1 jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestUnsignedIntArrayList.java Index: TestUnsignedIntArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestUnsignedIntArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:28 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ * @author Rodney Waldhoff */ public class TestUnsignedIntArrayList extends TestAbstractLongArrayList { //------------------------------------------------------------ Conventional public TestUnsignedIntArrayList(String testName) { super(testName); } public static Test suite() { TestSuite suite = new TestSuite(TestUnsignedIntArrayList.class); return suite; } //---------------------------------------------------------- Abstract Impls protected AbstractLongArrayList createList() { return new UnsignedIntArrayList(); } } 1.1 jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestUnsignedShortArrayList.java Index: TestUnsignedShortArrayList.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestUnsignedShortArrayList.java,v 1.1 2002/06/04 16:01:28 rwaldhoff Exp $ * $Revision: 1.1 $ * $Date: 2002/06/04 16:01:28 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, if * any, must include the following acknowlegement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Commons", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * nor may "Apache" appear in their names without prior written * permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * */ package org.apache.commons.collections.primitives; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * @version $Revision: 1.1 $ $Date: 2002/06/04 16:01:28 $ * @author Rodney Waldhoff */ public class TestUnsignedShortArrayList extends TestAbstractIntArrayList { //------------------------------------------------------------ Conventional public TestUnsignedShortArrayList(String testName) { super(testName); } public static Test suite() { TestSuite suite = new TestSuite(TestUnsignedShortArrayList.class); return suite; } //---------------------------------------------------------------- Abstract protected AbstractIntArrayList createList() { return new UnsignedShortArrayList(); } } -- To unsubscribe, e-mail: For additional commands, e-mail: