Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1B856200CC5 for ; Tue, 11 Jul 2017 19:52:56 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1A228163ABF; Tue, 11 Jul 2017 17:52:56 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 93B9316347D for ; Tue, 11 Jul 2017 19:52:53 +0200 (CEST) Received: (qmail 67375 invoked by uid 500); 11 Jul 2017 17:52:52 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 67257 invoked by uid 99); 11 Jul 2017 17:52:52 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Jul 2017 17:52:52 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8B904DFA84; Tue, 11 Jul 2017 17:52:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: chtompki@apache.org To: commits@commons.apache.org Date: Tue, 11 Jul 2017 17:52:52 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [02/22] commons-collections git commit: This commit was manufactured by cvs2svn to create branch 'COLLECTIONS_2_1_BRANCH'. archived-at: Tue, 11 Jul 2017 17:52:56 -0000 http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/primitives/IntArrayList.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/primitives/IntArrayList.java b/src/java/org/apache/commons/collections/primitives/IntArrayList.java deleted file mode 100644 index 1d62623..0000000 --- a/src/java/org/apache/commons/collections/primitives/IntArrayList.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/IntArrayList.java,v 1.7 2002/10/12 22:15:20 scolebourne Exp $ - * $Revision: 1.7 $ - * $Date: 2002/10/12 22:15:20 $ - * - * ==================================================================== - * - * 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; - -/** - * A list of int elements backed by an int array. - * This class implements the {@link java.util.List List} interface for an array of - * int values. This class uses less memory than an - * {@link java.util.ArrayList} of {@link Integer} values and allows for - * better compile-time type checking.

- * - * @version $Revision: 1.7 $ $Date: 2002/10/12 22:15:20 $ - * @author Rodney Waldhoff - */ -public class IntArrayList extends AbstractIntArrayList implements Serializable { - - //------------------------------------------------------------ Constructors - - /** - * Constructs a new IntArrayList with a default capacity. - */ - public IntArrayList() { - this(8); - } - - /** - * Constructs a new IntArrayList with the given capacity. - * - * @param the capacity for the list - * @throws IllegalArgumentException if the capacity is less than zero - */ - public IntArrayList(int capacity) { - if (capacity < 0) { - throw new IllegalArgumentException("capacity " + capacity); - } - _data = new int[capacity]; - } - - //--------------------------------------------------------------- Accessors - - // Note: JavaDoc for these methods is inherited from the superclass. - - 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 - - // Note: JavaDoc for these methods is inherited from the superclass. - - 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; -} http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/primitives/LongArrayList.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/primitives/LongArrayList.java b/src/java/org/apache/commons/collections/primitives/LongArrayList.java deleted file mode 100644 index f869a13..0000000 --- a/src/java/org/apache/commons/collections/primitives/LongArrayList.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/LongArrayList.java,v 1.7 2002/10/12 22:15:20 scolebourne Exp $ - * $Revision: 1.7 $ - * $Date: 2002/10/12 22:15:20 $ - * - * ==================================================================== - * - * 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; - -/** - * A list of long elements backed by a long array. - * This class implements the {@link java.util.List List} interface for an array of - * long values. This class uses less memory than an - * {@link java.util.ArrayList} of {@link Long} values and allows for - * better compile-time type checking.

- * - * @version $Revision: 1.7 $ $Date: 2002/10/12 22:15:20 $ - * @author Rodney Waldhoff - */ -public class LongArrayList extends AbstractLongArrayList implements Serializable { - - //------------------------------------------------------------ Constructors - - /** - * Constructs a new LongArrayList with a default initial - * capacity. - */ - public LongArrayList() { - this(8); - } - - /** - * Constructs a new LongArrayList with the given initial - * capacity. - * - * @param capacity the initial capacity for the array - * @throws IllegalArgumentException if the capacity is less than zero - */ - public LongArrayList(int capacity) { - if (capacity < 0) { - throw new IllegalArgumentException("capacity=" + 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; -} http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/primitives/ShortArrayList.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/primitives/ShortArrayList.java b/src/java/org/apache/commons/collections/primitives/ShortArrayList.java deleted file mode 100644 index e9d3735..0000000 --- a/src/java/org/apache/commons/collections/primitives/ShortArrayList.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/ShortArrayList.java,v 1.7 2002/10/12 22:15:20 scolebourne Exp $ - * $Revision: 1.7 $ - * $Date: 2002/10/12 22:15:20 $ - * - * ==================================================================== - * - * 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; - -/** - * A list of short elements backed by an short array. - * This class implements the {@link java.util.List List} interface for an array of - * short values. This class uses less memory than an - * {@link java.util.ArrayList} of {@link Short} values and allows for - * better compile-time type checking.

- * - * @version $Revision: 1.7 $ $Date: 2002/10/12 22:15:20 $ - * @author Rodney Waldhoff - */ -public class ShortArrayList extends AbstractShortArrayList implements Serializable { - - //------------------------------------------------------------ Constructors - - /** - * Constructs a new ShortArrayList with a default initial - * capacity. - */ - public ShortArrayList() { - this(8); - } - - /** - * Constructs a new ShortArrayList with the given initial - * capacity. - * - * @param capacity the initial capacity for the array - * @throws IllegalArgumentException if the capacity is less than zero - */ - public ShortArrayList(int capacity) { - if (capacity < 0) { - throw new IllegalArgumentException("capacity=" + 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; -} http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/primitives/UnsignedByteArrayList.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/primitives/UnsignedByteArrayList.java b/src/java/org/apache/commons/collections/primitives/UnsignedByteArrayList.java deleted file mode 100644 index 971c4cd..0000000 --- a/src/java/org/apache/commons/collections/primitives/UnsignedByteArrayList.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/UnsignedByteArrayList.java,v 1.7 2002/10/12 22:15:20 scolebourne Exp $ - * $Revision: 1.7 $ - * $Date: 2002/10/12 22:15:20 $ - * - * ==================================================================== - * - * 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; - -/** - * A list of unsigned 8-bit values backed by a byte array. - * The unsigned 8-bit values are converted to and from a signed 8-bit - * byte that's stored in the stored in the array. - * Mutators on this class will reject any short that does not - * express an unsigned 8-bit value. This implementation uses less memory - * than a {@link java.util.ArrayList} and offers better compile-time type - * checking. - * - * @version $Revision: 1.7 $ $Date: 2002/10/12 22:15:20 $ - * @author Rodney Waldhoff - */ -public class UnsignedByteArrayList extends AbstractShortArrayList implements Serializable { - - //------------------------------------------------------------ Constructors - - /** - * Constructs a new UnsignedByteArrayList with a - * default initial capacity. - */ - public UnsignedByteArrayList() { - this(8); - } - - /** - * Constructs a new UnsignedByteArrayList with the - * specified initial capacity. - * - * @param capacity the capacity for this list - * @throws IllegalArgumentException if the given capacity is less than zero - */ - public UnsignedByteArrayList(int capacity) { - if (capacity < 0) { - throw new IllegalArgumentException("capacity=" + 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; - - /** - * The maximum possible unsigned 8-bit value. - */ - public static final short MAX_VALUE = 0xFF; - - /** - * The minimum possible unsigned 8-bit value. - */ - public static final short MIN_VALUE = 0; -} http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/primitives/UnsignedIntArrayList.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/primitives/UnsignedIntArrayList.java b/src/java/org/apache/commons/collections/primitives/UnsignedIntArrayList.java deleted file mode 100644 index bde8c9b..0000000 --- a/src/java/org/apache/commons/collections/primitives/UnsignedIntArrayList.java +++ /dev/null @@ -1,281 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/UnsignedIntArrayList.java,v 1.7 2002/10/12 22:15:20 scolebourne Exp $ - * $Revision: 1.7 $ - * $Date: 2002/10/12 22:15:20 $ - * - * ==================================================================== - * - * 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; - -/** - * A list of unsigned 32-bit values backed by an int array. - * The unsigned 32-bit values are converted to and from a signed 32-bit - * int that's stored in the stored in the array. - * Mutators on this class will reject any long that does not - * express an unsigned 32-bit value. This implementation uses less memory - * than a {@link java.util.ArrayList} and offers better compile-time type - * checking. - * - * @version $Revision: 1.7 $ $Date: 2002/10/12 22:15:20 $ - * @author Rodney Waldhoff - */ -public class UnsignedIntArrayList extends AbstractLongArrayList implements Serializable { - - //------------------------------------------------------------ Constructors - - /** - * Constructs a new UnsignedIntArrayList with a - * default initial capacity. - */ - public UnsignedIntArrayList() { - this(8); - } - - /** - * Constructs a new UnsignedIntArrayList with the - * specified initial capacity. - * - * @param capacity the capacity for this list - * @throws IllegalArgumentException if the given capacity is less than zero - */ - public UnsignedIntArrayList(int capacity) { - if (capacity < 0) { - throw new IllegalArgumentException("capacity=" + 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; - - /** - * The maximum possible unsigned 32-bit value. - */ - public static final long MAX_VALUE = 0xFFFFFFFFL; - - /** - * The minimum possible unsigned 32-bit value. - */ - public static final long MIN_VALUE = 0L; -} http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/primitives/UnsignedShortArrayList.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/primitives/UnsignedShortArrayList.java b/src/java/org/apache/commons/collections/primitives/UnsignedShortArrayList.java deleted file mode 100644 index f39ac79..0000000 --- a/src/java/org/apache/commons/collections/primitives/UnsignedShortArrayList.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/UnsignedShortArrayList.java,v 1.7 2002/10/12 22:15:20 scolebourne Exp $ - * $Revision: 1.7 $ - * $Date: 2002/10/12 22:15:20 $ - * - * ==================================================================== - * - * 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; - -/** - * A list of unsigned 16-bit values backed by a short array. - * The unsigned 8-bit values are converted to and from a signed 16-bit - * short that's stored in the stored in the array. - * Mutators on this class will reject any int that does not - * express an unsigned 16-bit value. This implementation uses less memory - * than a {@link java.util.ArrayList} and offers better compile-time type - * checking. - * - * @version $Revision: 1.7 $ $Date: 2002/10/12 22:15:20 $ - * @author Rodney Waldhoff - */ -public class UnsignedShortArrayList extends AbstractIntArrayList implements Serializable { - - //------------------------------------------------------------ Constructors - - /** - * Constructs a new UnsignedShortArrayList with a - * default initial capacity. - */ - public UnsignedShortArrayList() { - this(8); - } - - - /** - * Constructs a new UnsignedShortArrayList with the - * specified initial capacity. - * - * @param capacity the capacity for this list - * @throws IllegalArgumentException if the given capacity is less than zero - */ - public UnsignedShortArrayList(int capacity) { - if (capacity < 0) { - throw new IllegalArgumentException("capacity=" + 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; - - /** - * The maximum possible unsigned 16-bit value. - */ - public static final int MAX_VALUE = 0xFFFF; - - - /** - * The minimum possible unsigned 16-bit value. - */ - public static final int MIN_VALUE = 0; -} http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/primitives/package.html ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/primitives/package.html b/src/java/org/apache/commons/collections/primitives/package.html deleted file mode 100644 index 818003c..0000000 --- a/src/java/org/apache/commons/collections/primitives/package.html +++ /dev/null @@ -1,18 +0,0 @@ - -Contains collection implementations that use primitive elements. Currently -the package offers lists of primitive elements that are backed by primitive -arrays, offering substantial memory and performance savings.

- -There are generally two layers of abstract per primitive list type. The -first layer, implemented by the Abstract*List classes, provides -default implementations for all of the java.util.List methods -and most of their primitive counterparts. The second layer of abstraction, -implemented by the Abstract*ArrayList classes, provides -additional method signatures for manipulating a list that's backed by a -primitive array.

- -Note that these layers are not provided for FloatArrayList, -and that many primitive types are not represented in this package at all; -these inconsistencies may be addressed by a future release. - - http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/test/org/apache/commons/collections/primitives/TestAbstractIntArrayList.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/primitives/TestAbstractIntArrayList.java b/src/test/org/apache/commons/collections/primitives/TestAbstractIntArrayList.java deleted file mode 100644 index d632cb6..0000000 --- a/src/test/org/apache/commons/collections/primitives/TestAbstractIntArrayList.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractIntArrayList.java,v 1.4 2002/10/12 22:36:21 scolebourne Exp $ - * $Revision: 1.4 $ - * $Date: 2002/10/12 22:36:21 $ - * - * ==================================================================== - * - * 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.util.List; - -import org.apache.commons.collections.TestList; - -/** - * @version $Revision: 1.4 $ $Date: 2002/10/12 22:36:21 $ - * @author Rodney Waldhoff - */ -public abstract class TestAbstractIntArrayList extends TestList { - - //------------------------------------------------------------ Conventional - - public TestAbstractIntArrayList(String testName) { - super(testName); - } - - //---------------------------------------------------------------- Abstract - - abstract protected AbstractIntList createList(); - - //------------------------------------------------------- TestList interface - - public List makeEmptyList() { - return createList(); - } - - //------------------------------------------------------------------- Tests - - public void testAddGet() { - AbstractIntList 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() { - AbstractIntList 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() { - AbstractIntList 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)); - } - } - - - /** - * Returns small Integer objects for testing. - */ - protected Object[] getFullElements() { - Integer[] result = new Integer[19]; - for (int i = 0; i < result.length; i++) { - result[i] = new Integer(i + 19); - } - return result; - } - - - /** - * Returns small Integer objects for testing. - */ - protected Object[] getOtherElements() { - Integer[] result = new Integer[16]; - for (int i = 0; i < result.length; i++) { - result[i] = new Integer(i + 48); - } - return result; - } - - // TODO: Create canonical collections in CVS - - public void testCanonicalEmptyCollectionExists() { - } - - - public void testCanonicalFullCollectionExists() { - } - - public void testEmptyListCompatibility() { - } - - public void testFullListCompatibility() { - } - - // TODO: Fix primitive lists to be fail fast - - public void testCollectionIteratorFailFast() { - } - - public void testListSubListFailFastOnAdd() { - } - - public void testListSubListFailFastOnRemove() { - } - -} - http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/test/org/apache/commons/collections/primitives/TestAbstractLongArrayList.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/primitives/TestAbstractLongArrayList.java b/src/test/org/apache/commons/collections/primitives/TestAbstractLongArrayList.java deleted file mode 100644 index 1832800..0000000 --- a/src/test/org/apache/commons/collections/primitives/TestAbstractLongArrayList.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractLongArrayList.java,v 1.4 2002/10/12 22:36:21 scolebourne Exp $ - * $Revision: 1.4 $ - * $Date: 2002/10/12 22:36:21 $ - * - * ==================================================================== - * - * 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.util.List; - -import org.apache.commons.collections.TestList; - -/** - * @version $Revision: 1.4 $ $Date: 2002/10/12 22:36:21 $ - * @author Rodney Waldhoff - */ -public abstract class TestAbstractLongArrayList extends TestList { - - //------------------------------------------------------------ Conventional - - public TestAbstractLongArrayList(String testName) { - super(testName); - } - - //---------------------------------------------------------------- Abstract - - abstract protected AbstractLongList createList(); - - //------------------------------------------------------- TestList interface - - public List makeEmptyList() { - return createList(); - } - - //------------------------------------------------------------------- Tests - - public void testAddGet() { - AbstractLongList 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() { - AbstractLongList 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)); - } - } - - - /** - * Returns an array of Long objects for testing. - */ - protected Object[] getFullElements() { - Long[] result = new Long[19]; - for (int i = 0; i < result.length; i++) { - result[i] = new Long(i + 19); - } - return result; - } - - - /** - * Returns an array of Long objects for testing. - */ - protected Object[] getOtherElements() { - Long[] result = new Long[16]; - for (int i = 0; i < result.length; i++) { - result[i] = new Long(i + 48); - } - return result; - } - - // TODO: Create canonical primitive lists in CVS - - public void testCanonicalEmptyCollectionExists() { - } - - - public void testCanonicalFullCollectionExists() { - } - - public void testEmptyListCompatibility() { - } - - public void testFullListCompatibility() { - } - - // TODO: Make primitive lists fail-fast - - public void testCollectionIteratorFailFast() { - } - - public void testListSubListFailFastOnAdd() { - } - - public void testListSubListFailFastOnRemove() { - } - - - -} - http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/test/org/apache/commons/collections/primitives/TestAbstractShortArrayList.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/primitives/TestAbstractShortArrayList.java b/src/test/org/apache/commons/collections/primitives/TestAbstractShortArrayList.java deleted file mode 100644 index f9ed119..0000000 --- a/src/test/org/apache/commons/collections/primitives/TestAbstractShortArrayList.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAbstractShortArrayList.java,v 1.4 2002/10/12 22:36:21 scolebourne Exp $ - * $Revision: 1.4 $ - * $Date: 2002/10/12 22:36:21 $ - * - * ==================================================================== - * - * 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.util.List; - -import org.apache.commons.collections.TestList; - -/** - * @version $Revision: 1.4 $ $Date: 2002/10/12 22:36:21 $ - * @author Rodney Waldhoff - */ -public abstract class TestAbstractShortArrayList extends TestList { - - //------------------------------------------------------------ Conventional - - public TestAbstractShortArrayList(String testName) { - super(testName); - } - - //---------------------------------------------------------------- Abstract - - abstract protected AbstractShortList createList(); - - //------------------------------------------------------- TestList interface - - public List makeEmptyList() { - return createList(); - } - - //------------------------------------------------------------------- Tests - - public void testAddGet() { - AbstractShortList 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() { - AbstractShortList 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)); - } - } - - /** - * Returns an array of Short objects for testing. - */ - protected Object[] getFullElements() { - Short[] result = new Short[19]; - for (int i = 0; i < result.length; i++) { - result[i] = new Short((short)(i + 19)); - } - return result; - } - - - /** - * Returns an array of Short objects for testing. - */ - protected Object[] getOtherElements() { - Short[] result = new Short[16]; - for (int i = 0; i < result.length; i++) { - result[i] = new Short((short)(i + 48)); - } - return result; - } - - // TODO: Create canonical primitive lists in CVS - - public void testCanonicalEmptyCollectionExists() { - } - - - public void testCanonicalFullCollectionExists() { - } - - public void testEmptyListCompatibility() { - } - - public void testFullListCompatibility() { - } - - // TODO: Make primitive lists fail fast - - public void testCollectionIteratorFailFast() { - } - - public void testListSubListFailFastOnAdd() { - } - - public void testListSubListFailFastOnRemove() { - } - - - - -} - http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/test/org/apache/commons/collections/primitives/TestAll.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/primitives/TestAll.java b/src/test/org/apache/commons/collections/primitives/TestAll.java deleted file mode 100644 index d073920..0000000 --- a/src/test/org/apache/commons/collections/primitives/TestAll.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestAll.java,v 1.2 2002/06/04 16:50:09 rwaldhoff Exp $ - * $Revision: 1.2 $ - * $Date: 2002/06/04 16:50:09 $ - * - * ==================================================================== - * - * 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.2 $ $Date: 2002/06/04 16:50:09 $ - * @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()); - suite.addTest(TestFloatArrayList.suite()); - return suite; - } -} - http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/test/org/apache/commons/collections/primitives/TestFloatArrayList.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/primitives/TestFloatArrayList.java b/src/test/org/apache/commons/collections/primitives/TestFloatArrayList.java deleted file mode 100644 index 35d9061..0000000 --- a/src/test/org/apache/commons/collections/primitives/TestFloatArrayList.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestFloatArrayList.java,v 1.4 2002/10/12 22:36:21 scolebourne Exp $ - * $Revision: 1.4 $ - * $Date: 2002/10/12 22:36:21 $ - * - * ==================================================================== - * - * 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.util.List; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.apache.commons.collections.TestList; - -/** - * @version $Revision: 1.4 $ $Date: 2002/10/12 22:36:21 $ - * @author Rodney Waldhoff - */ -public class TestFloatArrayList extends TestList { - - //------------------------------------------------------------ Conventional - - public TestFloatArrayList(String testName) { - super(testName); - } - - public static Test suite() { - TestSuite suite = TestList.makeSuite(TestFloatArrayList.class); - return suite; - } - - //--------------------------------------------------------------- Protected - - protected FloatArrayList createList() { - return new FloatArrayList(); - } - - //------------------------------------------------------ TestList interface - - public List makeEmptyList() { - return createList(); - } - - //------------------------------------------------------------------- Tests - - public void testZeroInitialCapacityIsValid() { - FloatArrayList list = new FloatArrayList(0); - } - - public void testAddGet() { - FloatArrayList list = createList(); - for(float i=0F;i<1000F;i++) { - list.addFloat(i); - } - for(int i=0;i<1000;i++) { - assertEquals((float)i,list.getFloat(i),Float.MAX_VALUE); - } - } - - - protected Object[] getFullElements() { - Float[] result = new Float[19]; - for (int i = 0; i < result.length; i++) { - result[i] = new Float((float)(i + 19)); - } - return result; - } - - - protected Object[] getOtherElements() { - Float[] result = new Float[16]; - for (int i = 0; i < result.length; i++) { - result[i] = new Float((float)(i + 48)); - } - return result; - } - - - public void testCanonicalEmptyCollectionExists() { - } - - - public void testCanonicalFullCollectionExists() { - } - - public void testEmptyListCompatibility() { - } - - public void testFullListCompatibility() { - } - - public void testCollectionIteratorFailFast() { - } - - public void testListSubListFailFastOnAdd() { - } - - public void testListSubListFailFastOnRemove() { - } - -} -