You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ch...@apache.org on 2017/07/11 17:52:53 UTC
[03/22] commons-collections git commit: This commit was manufactured
by cvs2svn to create branch 'COLLECTIONS_2_1_BRANCH'.
This commit was manufactured by cvs2svn to create branch
'COLLECTIONS_2_1_BRANCH'.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/branches/COLLECTIONS_2_1_BRANCH@131736 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/bc4bf904
Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/bc4bf904
Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/bc4bf904
Branch: refs/heads/COLLECTIONS_2_1_BRANCH
Commit: bc4bf9046295173dfbaef31833b96da07ca19fd5
Parents: 628285d
Author: No Author <de...@apache.org>
Authored: Sat May 22 09:46:39 2004 +0000
Committer: No Author <de...@apache.org>
Committed: Sat May 22 09:46:39 2004 +0000
----------------------------------------------------------------------
NOTICE.txt | 2 +
.../iterators/AbstractEmptyIterator.java | 89 ++++
.../collections/iterators/EmptyIterator.java | 54 +++
.../iterators/EmptyListIterator.java | 60 +++
.../primitives/AbstractIntArrayList.java | 104 -----
.../collections/primitives/AbstractIntList.java | 391 ------------------
.../primitives/AbstractLongArrayList.java | 106 -----
.../primitives/AbstractLongList.java | 398 ------------------
.../primitives/AbstractShortArrayList.java | 106 -----
.../primitives/AbstractShortList.java | 398 ------------------
.../collections/primitives/FloatArrayList.java | 407 -------------------
.../collections/primitives/IntArrayList.java | 246 -----------
.../collections/primitives/LongArrayList.java | 248 -----------
.../collections/primitives/ShortArrayList.java | 244 -----------
.../primitives/UnsignedByteArrayList.java | 282 -------------
.../primitives/UnsignedIntArrayList.java | 281 -------------
.../primitives/UnsignedShortArrayList.java | 284 -------------
.../commons/collections/primitives/package.html | 18 -
.../primitives/TestAbstractIntArrayList.java | 183 ---------
.../primitives/TestAbstractLongArrayList.java | 169 --------
.../primitives/TestAbstractShortArrayList.java | 165 --------
.../commons/collections/primitives/TestAll.java | 94 -----
.../primitives/TestFloatArrayList.java | 158 -------
.../primitives/TestIntArrayList.java | 99 -----
.../primitives/TestLongArrayList.java | 99 -----
.../primitives/TestShortArrayList.java | 99 -----
.../primitives/TestUnsignedByteArrayList.java | 99 -----
.../primitives/TestUnsignedIntArrayList.java | 99 -----
.../primitives/TestUnsignedShortArrayList.java | 99 -----
29 files changed, 205 insertions(+), 4876 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/NOTICE.txt
----------------------------------------------------------------------
diff --git a/NOTICE.txt b/NOTICE.txt
new file mode 100644
index 0000000..3f59805
--- /dev/null
+++ b/NOTICE.txt
@@ -0,0 +1,2 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java b/src/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java
new file mode 100644
index 0000000..18aaa5f
--- /dev/null
+++ b/src/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.iterators;
+
+import java.util.NoSuchElementException;
+
+/**
+ * Provides an implementation of an empty iterator.
+ *
+ * @since Commons Collections 3.1
+ * @version $Revision: 1.1 $ $Date: 2004/05/22 09:46:39 $
+ *
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractEmptyIterator {
+
+ /**
+ * Constructor.
+ */
+ protected AbstractEmptyIterator() {
+ super();
+ }
+
+ public boolean hasNext() {
+ return false;
+ }
+
+ public Object next() {
+ throw new NoSuchElementException("Iterator contains no elements");
+ }
+
+ public boolean hasPrevious() {
+ return false;
+ }
+
+ public Object previous() {
+ throw new NoSuchElementException("Iterator contains no elements");
+ }
+
+ public int nextIndex() {
+ return 0;
+ }
+
+ public int previousIndex() {
+ return -1;
+ }
+
+ public void add(Object obj) {
+ throw new UnsupportedOperationException("add() not supported for empty Iterator");
+ }
+
+ public void set(Object obj) {
+ throw new IllegalStateException("Iterator contains no elements");
+ }
+
+ public void remove() {
+ throw new IllegalStateException("Iterator contains no elements");
+ }
+
+ public Object getKey() {
+ throw new IllegalStateException("Iterator contains no elements");
+ }
+
+ public Object getValue() {
+ throw new IllegalStateException("Iterator contains no elements");
+ }
+
+ public Object setValue(Object value) {
+ throw new IllegalStateException("Iterator contains no elements");
+ }
+
+ public void reset() {
+ // do nothing
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/iterators/EmptyIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EmptyIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyIterator.java
new file mode 100644
index 0000000..d8b5eb1
--- /dev/null
+++ b/src/java/org/apache/commons/collections/iterators/EmptyIterator.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.iterators;
+
+import java.util.Iterator;
+
+import org.apache.commons.collections.ResettableIterator;
+
+/**
+ * Provides an implementation of an empty iterator.
+ * <p>
+ * This class provides an implementation of an empty iterator.
+ * This class provides for binary compatability between Commons Collections
+ * 2.1.1 and 3.1 due to issues with <code>IteratorUtils</code>.
+ *
+ * @since Commons Collections 2.1.1 and 3.1
+ * @version $Revision: 1.1 $ $Date: 2004/05/22 09:46:39 $
+ *
+ * @author Stephen Colebourne
+ */
+public class EmptyIterator extends AbstractEmptyIterator implements ResettableIterator {
+
+ /**
+ * Singleton instance of the iterator.
+ * @since Commons Collections 3.1
+ */
+ public static final ResettableIterator RESETTABLE_INSTANCE = new EmptyIterator();
+ /**
+ * Singleton instance of the iterator.
+ * @since Commons Collections 2.1.1 and 3.1
+ */
+ public static final Iterator INSTANCE = RESETTABLE_INSTANCE;
+
+ /**
+ * Constructor.
+ */
+ protected EmptyIterator() {
+ super();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java b/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java
new file mode 100644
index 0000000..53e4dd5
--- /dev/null
+++ b/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections.iterators;
+
+import java.util.ListIterator;
+
+import org.apache.commons.collections.OrderedIterator;
+import org.apache.commons.collections.ResettableListIterator;
+
+/**
+ * Provides an implementation of an empty list iterator.
+ * <p>
+ * This class provides an implementation of an empty list iterator.
+ * This class provides for binary compatability between Commons Collections
+ * 2.1.1 and 3.1 due to issues with <code>IteratorUtils</code>.
+ *
+ * @since Commons Collections 2.1.1 and 3.1
+ * @version $Revision: 1.1 $ $Date: 2004/05/22 09:46:39 $
+ *
+ * @author Stephen Colebourne
+ */
+public class EmptyListIterator extends AbstractEmptyIterator implements ResettableListIterator, OrderedIterator {
+
+ /**
+ * Singleton instance of the iterator.
+ * @since Commons Collections 3.1
+ */
+ public static final ResettableListIterator RESETTABLE_INSTANCE = new EmptyListIterator();
+ /**
+ * Singleton instance of the iterator.
+ * @since Commons Collections 2.1.1 and 3.1
+ */
+ public static final ListIterator INSTANCE = RESETTABLE_INSTANCE;
+ /**
+ * Singleton instance of the iterator.
+ * @since Commons Collections 3.1
+ */
+ public static final OrderedIterator ORDERED_INSTANCE = (OrderedIterator) RESETTABLE_INSTANCE;
+
+ /**
+ * Constructor.
+ */
+ protected EmptyListIterator() {
+ super();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/primitives/AbstractIntArrayList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/primitives/AbstractIntArrayList.java b/src/java/org/apache/commons/collections/primitives/AbstractIntArrayList.java
deleted file mode 100644
index 368f356..0000000
--- a/src/java/org/apache/commons/collections/primitives/AbstractIntArrayList.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/AbstractIntArrayList.java,v 1.6 2002/10/12 22:15:20 scolebourne Exp $
- * $Revision: 1.6 $
- * $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
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.commons.collections.primitives;
-
-
-
-/**
- * Abstract base class for lists of primitive <Code>int</Code> elements
- * backed by an array.<P>
- *
- * Extending this class is essentially the same as extending its superclass
- * ({@link AbstractIntList}. However, this class assumes that the
- * primitive values will be stored in an underlying primitive array, and
- * provides methods for manipulating the capacity of that array.<P>
- *
- * @version $Revision: 1.6 $ $Date: 2002/10/12 22:15:20 $
- * @author Rodney Waldhoff
- */
-public abstract class AbstractIntArrayList extends AbstractIntList {
-
- //------------------------------------------------------ Abstract Accessors
-
- /**
- * Returns the maximum size the list can reach before the array
- * is resized.
- *
- * @return the maximum size the list can reach before the array is resized
- */
- abstract public int capacity();
-
- /**
- * Ensures that the length of the internal <Code>int</Code> array is
- * at list the given value.
- *
- * @param mincap the minimum capcity for this list
- */
- abstract public void ensureCapacity(int mincap);
-
- /**
- * Resizes the internal array such that {@link #capacity()} is equal
- * to {@link #size()}.
- */
- abstract public void trimToSize();
-
-}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/primitives/AbstractIntList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/primitives/AbstractIntList.java b/src/java/org/apache/commons/collections/primitives/AbstractIntList.java
deleted file mode 100644
index b20fb58..0000000
--- a/src/java/org/apache/commons/collections/primitives/AbstractIntList.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/AbstractIntList.java,v 1.4 2002/10/12 22:15:20 scolebourne Exp $
- * $Revision: 1.4 $
- * $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
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.commons.collections.primitives;
-
-import java.util.AbstractList;
-
-/**
- * Abstract base class for lists of primitive <Code>int</Code> elements.<P>
- *
- * The {@link java.util.List List} methods are all implemented, but they forward to
- * abstract methods that operate on <Code>int</Code> elements. For
- * instance, the {@link #get(int)} method simply forwards to
- * {@link #getInt(int)}. The primitive <Code>int</Code> that is
- * returned from {@link #getInt(int)} is wrapped in a {@link java.lang.Integer}
- * and returned from {@link #get(int)}.<p>
- *
- * Concrete implementations offer substantial memory savings by not storing
- * primitives as wrapped objects. If you excuslively use the primitive
- * signatures, there can also be substantial performance gains, since
- * temporary wrapper objects do not need to be created.<p>
- *
- * To implement a read-only list of <Code>int</Code> elements, you need
- * only implement the {@link #getInt(int)} and {@link #size()} methods.
- * To implement a modifiable list, you will also need to implement the
- * {@link #setInt(int,int)}, {@link #addInt(int,int)},
- * {@link #removeIntAt(int)} and {@link #clear()} methods. You may want
- * to override the other methods to increase performance.<P>
- *
- * @version $Revision: 1.4 $ $Date: 2002/10/12 22:15:20 $
- * @author Rodney Waldhoff
- */
-public abstract class AbstractIntList extends AbstractList {
-
- //------------------------------------------------------ Abstract Accessors
-
- /**
- * Returns the number of <Code>int</Code> elements currently in this
- * list.
- *
- * @return the size of this list
- */
- abstract public int size();
-
-
- /**
- * Returns the <Code>int</Code> element at the specified index in this
- * array.
- *
- * @param index the index of the element to return
- * @return the <Code>int</Code> element at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}
- */
- abstract public int getInt(int index);
-
- //--------------------------------------------------------------- Accessors
-
- /**
- * Returns <Code>true</Code> if this list contains the given
- * <Code>int</Code> element. The default implementation uses
- * {@link #indexOfInt(int)} to determine if the given value is
- * in this list.
- *
- * @param value the element to search for
- * @return true if this list contains the given value, false otherwise
- */
- public boolean containsInt(int value) {
- return indexOfInt(value) >= 0;
- }
-
- /**
- * Returns the first index of the given <Code>int</Code> element, or
- * -1 if the value is not in this list. The default implementation is:
- *
- * <pre>
- * for (int i = 0; i < size(); i++) {
- * if (getInt(i) == value) return i;
- * }
- * return -1;
- * </pre>
- *
- * @param value the element to search for
- * @return the first index of that element, or -1 if the element is
- * not in this list
- */
- public int indexOfInt(int value) {
- for (int i = 0; i < size(); i++) {
- if (getInt(i) == value) return i;
- }
- return -1;
- }
-
- /**
- * Returns the last index of the given <Code>int</Code> element, or
- * -1 if the value is not in this list. The default implementation is:
- *
- * <pre>
- * for (int i = size() - 1; i >= 0; i--) {
- * if (getInt(i) == value) return i;
- * }
- * return -1;
- * </pre>
- *
- * @param value the element to search for
- * @return the last index of that element, or -1 if the element is
- * not in this list
- */
- public int lastIndexOfInt(int value) {
- for (int i = size() - 1; i >= 0; i--) {
- if (getInt(i) == value) return i;
- }
- return -1;
- }
-
- /**
- * Returns <code>new Integer({@link #getInt getInt(index)})</code>.
- *
- * @param index the index of the element to return
- * @return an {@link Integer} object wrapping the <Code>int</Code>
- * value at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}
- */
- public Object get(int index) {
- return new Integer(getInt(index));
- }
-
- /**
- * Returns <code>{@link #containsInt containsInt(((Integer)value).intValue())}</code>.
- *
- * @param value an {@link Integer} object whose wrapped <Code>int</Code>
- * value to search for
- * @return true if this list contains that <Code>int</Code> value
- * @throws ClassCastException if the given object is not an
- * {@link Integer}
- * @throws NullPointerException if the given object is <Code>null</Code>
- */
- public boolean contains(Object value) {
- return containsInt(((Integer)value).intValue());
- }
-
- /**
- * Returns <code>({@link #size} == 0)</code>.
- *
- * @return true if this list is empty, false otherwise
- */
- public boolean isEmpty() {
- return (0 == size());
- }
-
- /**
- * Returns <code>{@link #indexOfInt indexOfInt(((Integer)value).intValue())}</code>.
- *
- * @param value an {@link Integer} object whose wrapped <Code>int</Code>
- * value to search for
- * @return the first index of that <Code>int</Code> value, or -1 if
- * this list does not contain that value
- * @throws ClassCastException if the given object is not an
- * {@link Integer}
- * @throws NullPointerException if the given object is <Code>null</Code>
- */
- public int indexOf(Object value) {
- return indexOfInt(((Integer)value).intValue());
- }
-
- /**
- * Returns <code>{@link #lastIndexOfInt lastIndexOfInt(((Integer)value).intValue())}</code>.
- *
- * @param value an {@link Integer} object whose wrapped <Code>int</Code>
- * value to search for
- * @return the last index of that <Code>int</Code> value, or -1 if
- * this list does not contain that value
- * @throws ClassCastException if the given object is not an
- * {@link Integer}
- * @throws NullPointerException if the given object is <Code>null</Code>
- */
- public int lastIndexOf(Object value) {
- return lastIndexOfInt(((Integer)value).intValue());
- }
-
- //------------------------------------------------------ Abstract Modifiers
-
- /**
- * Sets the element at the given index to the given <Code>int</Code>
- * value.
- *
- * @param index the index of the element to set
- * @param value the <Code>int</Code> value to set it to
- * @return the previous <Code>int</Code> value at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}.
- */
- abstract public int setInt(int index, int value);
-
- /**
- * Inserts the given <Code>int</Code> value into this list at the
- * specified index.
- *
- * @param index the index for the insertion
- * @param value the value to insert at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than {@link #size()}
- */
- abstract public void addInt(int index, int value);
-
-
- /**
- * Removes the <Code>int</Code> element at the specified index.
- *
- * @param index the index of the element to remove
- * @return the removed <Code>int</Code> value
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}
- */
- abstract public int removeIntAt(int index);
-
- /**
- * Removes all <Code>int</Code> values from this list.
- */
- abstract public void clear();
-
- //--------------------------------------------------------------- Modifiers
-
- /**
- * Adds the given <Code>int</Code> value to the end of this list.
- * The default implementation invokes {@link #addInt(int,int)
- * addInt(size(), value)}.
- *
- * @param value the value to add
- * @return true, always
- */
- public boolean addInt(int value) {
- addInt(size(), value);
- return true;
- }
-
- /**
- * Removes the first occurrence of the given <Code>int</Code> value
- * from this list. The default implementation is:
- *
- * <pre>
- * int i = indexOfInt(value);
- * if (i < 0) return false;
- * removeIntAt(i);
- * return true;
- * </pre>
- *
- * @param value the value to remove
- * @return true if this list contained that value and removed it,
- * or false if this list didn't contain the value
- */
- public boolean removeInt(int value) {
- int i = indexOfInt(value);
- if (i < 0) return false;
- removeIntAt(i);
- return true;
- }
-
- /**
- * Returns <code>new Integer({@link #setInt(int,int)
- * setInt(index,((Integer)value).intValue())})</code>.
- *
- * @param index the index of the element to set
- * @param value an {@link Integer} object whose <Code>int</Code> value
- * to set at that index
- * @return an {@link Integer} that wraps the <Code>int</Code> value
- * previously at that index
- * @throws IndexOutOfBoundsException if the index is negative or greater
- * than or equal to {@link #size()}
- * @throws ClassCastException if the given value is not an {@link Integer}
- * @throws NullPointerException if the given value is <Code>null</COde>
- */
- public Object set(int index, Object value) {
- return new Integer(setInt(index,((Integer)value).intValue()));
- }
-
- /**
- * Invokes <code>{@link #addInt(int) addInt(((Integer)value).intValue())})</code>.
- *
- * @param value an {@link Integer} object that wraps the <Code>int</Code>
- * value to add
- * @return true, always
- * @throws ClassCastException if the given value is not an {@link Integer}
- * @throws NullPointerException if the given value is <Code>null</COde>
- */
- public boolean add(Object value) {
- return addInt(((Integer)value).intValue());
- }
-
- /**
- * Invokes <code>{@link #addInt(int,int) addInt(index,((Integer)value).intValue())})</code>.
- *
- * @param index the index of the insertion
- * @param value an {@link Integer} object that wraps the <Code>int</Code>
- * value to insert
- * @throws IndexOutOfBoundsException if the index is negative or greater
- * than {@link #size()}
- * @throws ClassCastException if the given value is not an {@link Integer}
- * @throws NullPointerException if the given value is <Code>null</COde>
- */
- public void add(int index, Object value) {
- addInt(index,((Integer)value).intValue());
- }
-
- /**
- * Returns <code>new Integer({@link #removeIntAt(int) removeIntAt(index)})</code>.
- *
- * @param index the index of the element to remove
- * @return an {@link Integer} object that wraps the value that was
- * removed from that index
- * @throws IndexOutOfBoundsException if the given index is negative
- * or greater than or equal to {@link #size()}
- */
- public Object remove(int index) {
- return new Integer(removeIntAt(index));
- }
-
- /**
- * Returns <code>{@link #removeInt(int) removeInt(((Integer)value).intValue())}</code>.
- *
- * @param value an {@link Integer} object that wraps the <Code>int</Code>
- * value to remove
- * @return true if the first occurrence of that <Code>int</Code> value
- * was removed from this list, or <Code>false</Code> if this list
- * did not contain that <Code>int</Code> value
- * @throws ClassCastException if the given value is not an {@link Integer}
- * @throws NullPointerException if the given value is <Code>null</COde>
- */
- public boolean remove(Object value) {
- return removeInt(((Integer)value).intValue());
- }
-}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/primitives/AbstractLongArrayList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/primitives/AbstractLongArrayList.java b/src/java/org/apache/commons/collections/primitives/AbstractLongArrayList.java
deleted file mode 100644
index dfe31f8..0000000
--- a/src/java/org/apache/commons/collections/primitives/AbstractLongArrayList.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/AbstractLongArrayList.java,v 1.6 2002/10/12 22:15:20 scolebourne Exp $
- * $Revision: 1.6 $
- * $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
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.commons.collections.primitives;
-
-
-
-/**
- * Abstract base class for lists of primitive <Code>long</Code> elements
- * backed by an array.<P>
- *
- * Extending this class is essentially the same as extending its superclass
- * ({@link AbstractLongList}. However, this class assumes that the
- * primitive values will be stored in an underlying primitive array, and
- * provides methods for manipulating the capacity of that array.<P>
- *
- * @version $Revision: 1.6 $ $Date: 2002/10/12 22:15:20 $
- * @author Rodney Waldhoff
- */
-public abstract class AbstractLongArrayList extends AbstractLongList {
-
- //------------------------------------------------------ Abstract Accessors
-
- /**
- * Returns the maximum size the list can reach before the array
- * is resized.
- *
- * @return the maximum size the list can reach before the array is resized
- */
- abstract public int capacity();
-
- //------------------------------------------------------ Abstract Modifiers
-
- /**
- * Ensures that the length of the internal <Code>long</Code> array is
- * at list the given value.
- *
- * @param mincap the minimum capcity for this list
- */
- abstract public void ensureCapacity(int mincap);
-
- /**
- * Resizes the internal array such that {@link #capacity()} is equal
- * to {@link #size()}.
- */
- abstract public void trimToSize();
-
-}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/primitives/AbstractLongList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/primitives/AbstractLongList.java b/src/java/org/apache/commons/collections/primitives/AbstractLongList.java
deleted file mode 100644
index b41c4aa..0000000
--- a/src/java/org/apache/commons/collections/primitives/AbstractLongList.java
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/AbstractLongList.java,v 1.4 2002/10/12 22:15:20 scolebourne Exp $
- * $Revision: 1.4 $
- * $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
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.commons.collections.primitives;
-
-import java.util.AbstractList;
-
-/**
- * Abstract base class for lists of primitive <Code>long</Code> elements.<P>
- *
- * The {@link java.util.List List} methods are all implemented, but they forward to
- * abstract methods that operate on <Code>long</Code> elements. For
- * instance, the {@link #get(int)} method simply forwards to
- * {@link #getLong(int)}. The primitive <Code>long</Code> that is
- * returned from {@link #getLong(int)} is wrapped in a {@link java.lang.Long}
- * and returned from {@link #get(int)}.<p>
- *
- * Concrete implementations offer substantial memory savings by not storing
- * primitives as wrapped objects. If you excuslively use the primitive
- * signatures, there can also be substantial performance gains, since
- * temporary wrapper objects do not need to be created.<p>
- *
- * To implement a read-only list of <Code>long</Code> elements, you need
- * only implement the {@link #getLong(int)} and {@link #size()} methods.
- * To implement a modifiable list, you will also need to implement the
- * {@link #setLong(int,long)}, {@link #addLong(int,long)},
- * {@link #removeLongAt(int)} and {@link #clear()} methods. You may want
- * to override the other methods to increase performance.<P>
- *
- * @version $Revision: 1.4 $ $Date: 2002/10/12 22:15:20 $
- * @author Rodney Waldhoff
- */
-public abstract class AbstractLongList extends AbstractList {
-
- //------------------------------------------------------ Abstract Accessors
-
- /**
- * Returns the number of <Code>long</Code> elements currently in this
- * list.
- *
- * @return the size of this list
- */
- abstract public int size();
-
- /**
- * Returns the <Code>long</Code> element at the specified index in this
- * array.
- *
- * @param index the index of the element to return
- * @return the <Code>long</Code> element at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}
- */
- abstract public long getLong(int index);
-
- //--------------------------------------------------------------- Accessors
-
- /**
- * Returns <Code>true</Code> if this list contains the given
- * <Code>long</Code> element. The default implementation uses
- * {@link #indexOfLong(long)} to determine if the given value is
- * in this list.
- *
- * @param value the element to search for
- * @return true if this list contains the given value, false otherwise
- */
- public boolean containsLong(long value) {
- return indexOfLong(value) >= 0;
- }
-
- /**
- * Returns the first index of the given <Code>long</Code> element, or
- * -1 if the value is not in this list. The default implementation is:
- *
- * <pre>
- * for (int i = 0; i < size(); i++) {
- * if (getLong(i) == value) return i;
- * }
- * return -1;
- * </pre>
- *
- * @param value the element to search for
- * @return the first index of that element, or -1 if the element is
- * not in this list
- */
- public int indexOfLong(long value) {
- for (int i = 0; i < size(); i++) {
- if (getLong(i) == value) return i;
- }
- return -1;
- }
-
- /**
- * Returns the last index of the given <Code>long</Code> element, or
- * -1 if the value is not in this list. The default implementation is:
- *
- * <pre>
- * for (int i = size() - 1; i >= 0; i--) {
- * if (getLong(i) == value) return i;
- * }
- * return -1;
- * </pre>
- *
- * @param value the element to search for
- * @return the last index of that element, or -1 if the element is
- * not in this list
- */
- public int lastIndexOfLong(long value) {
- for (int i = size() - 1; i >= 0; i--) {
- if (getLong(i) == value) return i;
- }
- return -1;
- }
-
- /**
- * Returns <code>new Long({@link #getLong getLong(index)})</code>.
- *
- * @param index the index of the element to return
- * @return an {@link Long} object wrapping the <Code>long</Code>
- * value at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}
- */
- public Object get(int index) {
- return new Long(getLong(index));
- }
-
- /**
- * Returns <code>{@link #containsLong containsLong(((Long)value).longValue())}</code>.
- *
- * @param value an {@link Long} object whose wrapped <Code>long</Code>
- * value to search for
- * @return true if this list contains that <Code>long</Code> value
- * @throws ClassCastException if the given object is not an
- * {@link Long}
- * @throws NullPointerException if the given object is <Code>null</Code>
- */
- public boolean contains(Object value) {
- return containsLong(((Long)value).longValue());
- }
-
- /**
- * Returns <code>({@link #size} == 0)</code>.
- *
- * @return true if this list is empty, false otherwise
- */
- public boolean isEmpty() {
- return (0 == size());
- }
-
- /**
- * Returns <code>{@link #indexOfLong indexOfLong(((Long).longValue())}</code>.
- *
- * @param value an {@link Long} object whose wrapped <Code>long</Code>
- * value to search for
- * @return the first index of that <Code>long</Code> value, or -1 if
- * this list does not contain that value
- * @throws ClassCastException if the given object is not an
- * {@link Long}
- * @throws NullPointerException if the given object is <Code>null</Code>
- */
- public int indexOf(Object value) {
- return indexOfLong(((Long)value).longValue());
- }
-
- /**
- * Returns <code>{@link #lastIndexOfLong lastIndexOfLong(((Long).longValue())}</code>.
- *
- * @param value an {@link Long} object whose wrapped <Code>long</Code>
- * value to search for
- * @return the last index of that <Code>long</Code> value, or -1 if
- * this list does not contain that value
- * @throws ClassCastException if the given object is not an
- * {@link Long}
- * @throws NullPointerException if the given object is <Code>null</Code>
- */
- public int lastIndexOf(Object value) {
- return lastIndexOfLong(((Long)value).longValue());
- }
-
- //------------------------------------------------------ Abstract Modifiers
-
- /**
- * Sets the element at the given index to the given <Code>long</Code>
- * value.
- *
- * @param index the index of the element to set
- * @param value the <Code>long</Code> value to set it to
- * @return the previous <Code>long</Code> value at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}.
- */
- abstract public long setLong(int index, long value);
-
- /**
- * Inserts the given <Code>long</Code> value into this list at the
- * specified index.
- *
- * @param index the index for the insertion
- * @param value the value to insert at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than {@link #size()}
- */
- abstract public void addLong(int index, long value);
-
- /**
- * Removes the <Code>long</Code> element at the specified index.
- *
- * @param index the index of the element to remove
- * @return the removed <Code>long</Code> value
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}
- */
- abstract public long removeLongAt(int index);
-
- /**
- * Removes all <Code>long</Code> values from this list.
- */
- abstract public void clear();
-
- //--------------------------------------------------------------- Modifiers
-
- /**
- * Adds the given <Code>long</Code> value to the end of this list.
- * The default implementation invokes {@link #addLong(int,long)
- * addLong(size(), value)}.
- *
- * @param value the value to add
- * @return true, always
- */
- public boolean addLong(long value) {
- addLong(size(), value);
- return true;
- }
-
- /**
- * Removes the first occurrence of the given <Code>long</Code> value
- * from this list. The default implementation is:
- *
- * <pre>
- * int i = indexOfLong(value);
- * if (i < 0) return false;
- * removeLongAt(i);
- * return true;
- * </pre>
- *
- * @param value the value to remove
- * @return true if this list contained that value and removed it,
- * or false if this list didn't contain the value
- */
- public boolean removeLong(long value) {
- int i = indexOfLong(value);
- if (i < 0) return false;
- removeLongAt(i);
- return true;
- }
-
- /**
- * Returns <code>new Long({@link #setLong(int,long)
- * setLong(index,((Long).longValue())})</code>.
- *
- * @param index the index of the element to set
- * @param value an {@link Long} object whose <Code>long</Code> value
- * to set at that index
- * @return an {@link Long} that wraps the <Code>long</Code> value
- * previously at that index
- * @throws IndexOutOfBoundsException if the index is negative or greater
- * than or equal to {@link #size()}
- * @throws ClassCastException if the given value is not an {@link Long}
- * @throws NullPointerException if the given value is <Code>null</COde>
- */
- public Object set(int index, Object value) {
- return new Long(setLong(index,((Long)value).longValue()));
- }
-
- /**
- * Invokes <code>{@link #addLong(long) addLong(((Long)value).longValue())})</code>.
- *
- * @param value an {@link Long} object that wraps the <Code>long</Code>
- * value to add
- * @return true, always
- * @throws ClassCastException if the given value is not an {@link Long}
- * @throws NullPointerException if the given value is <Code>null</COde>
- */
- public boolean add(Object value) {
- return addLong(((Long)value).longValue());
- }
-
- /**
- * Invokes <code>{@link #addLong(int,long) addLong(index,((Long)value).longValue())})</code>.
- *
- * @param index the index of the insertion
- * @param value an {@link Long} object that wraps the <Code>long</Code>
- * value to insert
- * @throws IndexOutOfBoundsException if the index is negative or greater
- * than {@link #size()}
- * @throws ClassCastException if the given value is not an {@link Long}
- * @throws NullPointerException if the given value is <Code>null</COde>
- */
- public void add(int index, Object value) {
- addLong(index,((Long)value).longValue());
- }
-
- /**
- * Returns <code>new Long({@link #removeLongAt(int) removeLongAt(index)})</code>.
- *
- * @param index the index of the element to remove
- * @return an {@link Long} object that wraps the value that was
- * removed from that index
- * @throws IndexOutOfBoundsException if the given index is negative
- * or greater than or equal to {@link #size()}
- */
- public Object remove(int index) {
- return new Long(removeLongAt(index));
- }
-
- /**
- * Returns <code>{@link #removeLong(long) removeLong(((Long)value).longValue())}</code>.
- *
- * @param value an {@link Long} object that wraps the <Code>long</Code>
- * value to remove
- * @return true if the first occurrence of that <Code>long</Code> value
- * was removed from this list, or <Code>false</Code> if this list
- * did not contain that <Code>long</Code> value
- * @throws ClassCastException if the given value is not an {@link Long}
- * @throws NullPointerException if the given value is <Code>null</COde>
- */
- public boolean remove(Object value) {
- return removeLong(((Long)value).longValue());
- }
-}
-
-
-
- //--------------------------------------------------------------- Accessors
-
-
-
-
-
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/primitives/AbstractShortArrayList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/primitives/AbstractShortArrayList.java b/src/java/org/apache/commons/collections/primitives/AbstractShortArrayList.java
deleted file mode 100644
index 4473338..0000000
--- a/src/java/org/apache/commons/collections/primitives/AbstractShortArrayList.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/AbstractShortArrayList.java,v 1.6 2002/10/12 22:15:20 scolebourne Exp $
- * $Revision: 1.6 $
- * $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
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.commons.collections.primitives;
-
-
-
-/**
- * Abstract base class for lists of primitive <Code>short</Code> elements
- * backed by an array.<P>
- *
- * Extending this class is essentially the same as extending its superclass
- * ({@link AbstractShortList}. However, this class assumes that the
- * primitive values will be stored in an underlying primitive array, and
- * provides methods for manipulating the capacity of that array.<P>
- *
- * @version $Revision: 1.6 $ $Date: 2002/10/12 22:15:20 $
- * @author Rodney Waldhoff
- */
-public abstract class AbstractShortArrayList extends AbstractShortList {
-
- //------------------------------------------------------ Abstract Accessors
-
- /**
- * Returns the maximum size the list can reach before the array
- * is resized.
- *
- * @return the maximum size the list can reach before the array is resized
- */
- abstract public int capacity();
-
- //------------------------------------------------------ Abstract Modifiers
-
- /**
- * Ensures that the length of the internal <Code>short</Code> array is
- * at list the given value.
- *
- * @param mincap the minimum capcity for this list
- */
- abstract public void ensureCapacity(int mincap);
-
- /**
- * Resizes the internal array such that {@link #capacity()} is equal
- * to {@link #size()}.
- */
- abstract public void trimToSize();
-
-}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/primitives/AbstractShortList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/primitives/AbstractShortList.java b/src/java/org/apache/commons/collections/primitives/AbstractShortList.java
deleted file mode 100644
index fb355e0..0000000
--- a/src/java/org/apache/commons/collections/primitives/AbstractShortList.java
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/AbstractShortList.java,v 1.4 2002/10/12 22:15:20 scolebourne Exp $
- * $Revision: 1.4 $
- * $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
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.commons.collections.primitives;
-
-import java.util.AbstractList;
-
-/**
- * Abstract base class for lists of primitive <Code>short</Code> elements.<P>
- *
- * The {@link java.util.List List} methods are all implemented, but they forward to
- * abstract methods that operate on <Code>short</Code> elements. For
- * instance, the {@link #get(int)} method simply forwards to
- * {@link #getShort(int)}. The primitive <Code>short</Code> that is
- * returned from {@link #getShort(int)} is wrapped in a {@link java.lang.Short}
- * and returned from {@link #get(int)}.<p>
- *
- * Concrete implementations offer substantial memory savings by not storing
- * primitives as wrapped objects. If you excuslively use the primitive
- * signatures, there can also be substantial performance gains, since
- * temporary wrapper objects do not need to be created.<p>
- *
- * To implement a read-only list of <Code>short</Code> elements, you need
- * only implement the {@link #getShort(int)} and {@link #size()} methods.
- * To implement a modifiable list, you will also need to implement the
- * {@link #setShort(int,short)}, {@link #addShort(int,short)},
- * {@link #removeShortAt(int)} and {@link #clear()} methods. You may want
- * to override the other methods to increase performance.<P>
- *
- * @version $Revision: 1.4 $ $Date: 2002/10/12 22:15:20 $
- * @author Rodney Waldhoff
- */
-public abstract class AbstractShortList extends AbstractList {
-
- //------------------------------------------------------ Abstract Accessors
-
- /**
- * Returns the number of <Code>short</Code> elements currently in this
- * list.
- *
- * @return the size of this list
- */
- abstract public int size();
-
- /**
- * Returns the <Code>short</Code> element at the specified index in this
- * array.
- *
- * @param index the index of the element to return
- * @return the <Code>short</Code> element at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}
- */
- abstract public short getShort(int index);
-
- //--------------------------------------------------------------- Accessors
-
- /**
- * Returns <Code>true</Code> if this list contains the given
- * <Code>short</Code> element. The default implementation uses
- * {@link #indexOfShort(short)} to determine if the given value is
- * in this list.
- *
- * @param value the element to search for
- * @return true if this list contains the given value, false otherwise
- */
- public boolean containsShort(short value) {
- return indexOfShort(value) >= 0;
- }
-
- /**
- * Returns the first index of the given <Code>short</Code> element, or
- * -1 if the value is not in this list. The default implementation is:
- *
- * <pre>
- * for (int i = 0; i < size(); i++) {
- * if (getShort(i) == value) return i;
- * }
- * return -1;
- * </pre>
- *
- * @param value the element to search for
- * @return the first index of that element, or -1 if the element is
- * not in this list
- */
- public int indexOfShort(short value) {
- for (int i = 0; i < size(); i++) {
- if (getShort(i) == value) return i;
- }
- return -1;
- }
-
- /**
- * Returns the last index of the given <Code>short</Code> element, or
- * -1 if the value is not in this list. The default implementation is:
- *
- * <pre>
- * for (int i = size() - 1; i >= 0; i--) {
- * if (getShort(i) == value) return i;
- * }
- * return -1;
- * </pre>
- *
- * @param value the element to search for
- * @return the last index of that element, or -1 if the element is
- * not in this list
- */
- public int lastIndexOfShort(short value) {
- for (int i = size() - 1; i >= 0; i--) {
- if (getShort(i) == value) return i;
- }
- return -1;
- }
-
- /**
- * Returns <code>new Short({@link #getShort getShort(index)})</code>.
- *
- * @param index the index of the element to return
- * @return an {@link Short} object wrapping the <Code>short</Code>
- * value at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}
- */
- public Object get(int index) {
- return new Short(getShort(index));
- }
-
- /**
- * Returns <code>{@link #containsShort containsShort(((Short)value.shortValue())}</code>.
- *
- * @param value an {@link Short} object whose wrapped <Code>short</Code>
- * value to search for
- * @return true if this list contains that <Code>short</Code> value
- * @throws ClassCastException if the given object is not an
- * {@link Short}
- * @throws NullPointerException if the given object is <Code>null</Code>
- */
- public boolean contains(Object value) {
- return containsShort(((Short)value).shortValue());
- }
-
- /**
- * Returns <code>({@link #size} == 0)</code>.
- *
- * @return true if this list is empty, false otherwise
- */
- public boolean isEmpty() {
- return (0 == size());
- }
-
- /**
- * Returns <code>{@link #indexOfShort indexOfShort(((Short)value.shortValue())}</code>.
- *
- * @param value an {@link Short} object whose wrapped <Code>short</Code>
- * value to search for
- * @return the first index of that <Code>short</Code> value, or -1 if
- * this list does not contain that value
- * @throws ClassCastException if the given object is not an
- * {@link Short}
- * @throws NullPointerException if the given object is <Code>null</Code>
- */
- public int indexOf(Object value) {
- return indexOfShort(((Short)value).shortValue());
- }
-
- /**
- * Returns <code>{@link #lastIndexOfShort lastIndexOfShort(((Short)value.shortValue())}</code>.
- *
- * @param value an {@link Short} object whose wrapped <Code>short</Code>
- * value to search for
- * @return the last index of that <Code>short</Code> value, or -1 if
- * this list does not contain that value
- * @throws ClassCastException if the given object is not an
- * {@link Short}
- * @throws NullPointerException if the given object is <Code>null</Code>
- */
- public int lastIndexOf(Object value) {
- return lastIndexOfShort(((Short)value).shortValue());
- }
-
- //------------------------------------------------------ Abstract Modifiers
-
- /**
- * Sets the element at the given index to the given <Code>short</Code>
- * value.
- *
- * @param index the index of the element to set
- * @param value the <Code>short</Code> value to set it to
- * @return the previous <Code>short</Code> value at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}.
- */
- abstract public short setShort(int index, short value);
-
- /**
- * Inserts the given <Code>short</Code> value into this list at the
- * specified index.
- *
- * @param index the index for the insertion
- * @param value the value to insert at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than {@link #size()}
- */
- abstract public void addShort(int index, short value);
-
- /**
- * Removes the <Code>short</Code> element at the specified index.
- *
- * @param index the index of the element to remove
- * @return the removed <Code>short</Code> value
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}
- */
- abstract public short removeShortAt(int index);
-
- /**
- * Removes all <Code>short</Code> values from this list.
- */
- abstract public void clear();
-
- //--------------------------------------------------------------- Modifiers
-
- /**
- * Adds the given <Code>short</Code> value to the end of this list.
- * The default implementation invokes {@link #addShort(int,short)
- * addShort(size(), value)}.
- *
- * @param value the value to add
- * @return true, always
- */
- public boolean addShort(short value) {
- addShort(size(), value);
- return true;
- }
-
- /**
- * Removes the first occurrence of the given <Code>short</Code> value
- * from this list. The default implementation is:
- *
- * <pre>
- * int i = indexOfShort(value);
- * if (i < 0) return false;
- * removeShortAt(i);
- * return true;
- * </pre>
- *
- * @param value the value to remove
- * @return true if this list contained that value and removed it,
- * or false if this list didn't contain the value
- */
- public boolean removeShort(short value) {
- int i = indexOfShort(value);
- if (i < 0) return false;
- removeShortAt(i);
- return true;
- }
-
- /**
- * Returns <code>new Short({@link #setShort(int,short)
- * setShort(index,((Short)value.shortValue())})</code>.
- *
- * @param index the index of the element to set
- * @param value an {@link Short} object whose <Code>short</Code> value
- * to set at that index
- * @return an {@link Short} that wraps the <Code>short</Code> value
- * previously at that index
- * @throws IndexOutOfBoundsException if the index is negative or greater
- * than or equal to {@link #size()}
- * @throws ClassCastException if the given value is not an {@link Short}
- * @throws NullPointerException if the given value is <Code>null</COde>
- */
- public Object set(int index, Object value) {
- return new Short(setShort(index,((Short)value).shortValue()));
- }
-
- /**
- * Invokes <code>{@link #addShort(short) addShort(((Short)value.shortValue())})</code>.
- *
- * @param value an {@link Short} object that wraps the <Code>short</Code>
- * value to add
- * @return true, always
- * @throws ClassCastException if the given value is not an {@link Short}
- * @throws NullPointerException if the given value is <Code>null</COde>
- */
- public boolean add(Object value) {
- return addShort(((Short)value).shortValue());
- }
-
- /**
- * Invokes <code>{@link #addShort(int,short) addShort(index,((Short)value.shortValue())})</code>.
- *
- * @param index the index of the insertion
- * @param value an {@link Short} object that wraps the <Code>short</Code>
- * value to insert
- * @throws IndexOutOfBoundsException if the index is negative or greater
- * than {@link #size()}
- * @throws ClassCastException if the given value is not an {@link Short}
- * @throws NullPointerException if the given value is <Code>null</COde>
- */
- public void add(int index, Object value) {
- addShort(index,((Short)value).shortValue());
- }
-
- /**
- * Returns <code>new Short({@link #removeShortAt(int) removeIntAt(index)})</code>.
- *
- * @param index the index of the element to remove
- * @return an {@link Short} object that wraps the value that was
- * removed from that index
- * @throws IndexOutOfBoundsException if the given index is negative
- * or greater than or equal to {@link #size()}
- */
- public Object remove(int index) {
- return new Short(removeShortAt(index));
- }
-
- /**
- * Returns <code>{@link #removeShort(short) removeShort(((Short)value.shortValue())}</code>.
- *
- * @param value an {@link Short} object that wraps the <Code>short</Code>
- * value to remove
- * @return true if the first occurrence of that <Code>short</Code> value
- * was removed from this list, or <Code>false</Code> if this list
- * did not contain that <Code>short</Code> value
- * @throws ClassCastException if the given value is not an {@link Short}
- * @throws NullPointerException if the given value is <Code>null</COde>
- */
- public boolean remove(Object value) {
- return removeShort(((Short)value).shortValue());
- }
-
-}
-
-
-
- //--------------------------------------------------------------- Accessors
-
-
-
-
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/bc4bf904/src/java/org/apache/commons/collections/primitives/FloatArrayList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/collections/primitives/FloatArrayList.java b/src/java/org/apache/commons/collections/primitives/FloatArrayList.java
deleted file mode 100644
index f17bd97..0000000
--- a/src/java/org/apache/commons/collections/primitives/FloatArrayList.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/FloatArrayList.java,v 1.6 2002/10/12 22:15:20 scolebourne Exp $
- * $Revision: 1.6 $
- * $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
- * <http://www.apache.org/>.
- *
- */
-
-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.List;
-
-/**
- * A list of <Code>float</Code> elements backed by a <Code>float</Code> array.
- * This class implements the {@link List} interface for an array of
- * <Code>float</Code> values. This class uses less memory than an
- * {@link java.util.ArrayList} of {@link Float} values and allows for
- * better compile-time type checking.<P>
- *
- * @version $Revision: 1.6 $ $Date: 2002/10/12 22:15:20 $
- * @author Rodney Waldhoff
- */
-public class FloatArrayList extends AbstractList implements List, Serializable {
-
- //------------------------------------------------------------ Constructors
-
- /**
- * Constructs a new <Code>FloatArrayList</Code> with a default initial
- * capacity.
- */
- public FloatArrayList() {
- this(8);
- }
-
- /**
- * Constructs a new <Code>FloatArrayList</Code> with the specified initial
- * capacity.
- *
- * @param capacity the initial capacity for the list
- * @throws IllegalArgumentException if capacity is less than zero
- */
- public FloatArrayList(int capacity) {
- if (capacity < 0) {
- throw new IllegalArgumentException("capacity=" + capacity);
- }
- _data = new float[capacity];
- }
-
- //--------------------------------------------------------------- Accessors
-
- /**
- * Returns the capacity of this list.
- *
- * @return the capacity of this list
- */
- public int capacity() {
- return _data.length;
- }
-
- /**
- * Returns the size of this list.
- *
- * @return the size of this list
- */
- public int size() {
- return _size;
- }
-
- /**
- * Returns a {@link Float} that wraps the <Code>float</Code> value at
- * the given index.
- *
- * @param index the index of the <Code>float</Code>value to return
- * @return a {@link Float} that wraps the <Code>float</Code> value
- * at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}
- */
- public Object get(int index) {
- checkRange(index);
- return new Float(_data[index]);
- }
-
- /**
- * Returns the <Code>float</Code> value at the given index.
- *
- * @param index the index of the <Code>float</Code> value to return
- * @return the <Code>float</Code> value at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}
- */
- public float getFloat(int index) {
- checkRange(index);
- return _data[index];
- }
-
- /**
- * Returns true if this list contains the given <Code>float</Code>
- * value.
- *
- * @param value the <Code>float</COde> value to search for
- * @return true if this list contains the given <Code>float</COde>
- * value, false otherwise
- */
- public boolean containsFloat(float value) {
- return (-1 != indexOfFloat(value));
- }
-
- /**
- * Returns the index of the first occurrence of the given <Code>float</Code>
- * value, or -1 if this list does not contain that value.
- *
- * @param value the <Code>float</COde> value to search for
- * @return the index of the first occurrence of that value, or -1
- * if this list does not contain that value
- */
- public int indexOfFloat(float value) {
- for(int i=0;i<_size;i++) {
- if(value == _data[i]) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * Returns the index of the last occurrence of the given <Code>float</Code>
- * value, or -1 if this list does not contain that value.
- *
- * @param value the <Code>float</COde> value to search for
- * @return the index of the last occurrence of that value, or -1
- * if this list does not contain that value
- */
- public int lastIndexOfFloat(float value) {
- for(int i=_size-1;i>=0;i--) {
- if(value == _data[i]) {
- return i;
- }
- }
- return -1;
- }
-
- //--------------------------------------------------------------- Modifiers
-
- /**
- * Sets the element at the given index to the given <Code>float</COde>
- * value.
- *
- * @param index the index of the element to set
- * @param value the new <Code>float</Code> value for that element
- * @return the previous <Code>float</Code> value at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}
- */
- public float setFloat(int index, float value) {
- checkRange(index);
- float old = _data[index];
- _data[index] = value;
- return old;
- }
-
- /**
- * Returns <Code>new Float({@link #setFloat(int,float)
- * set(index, ((Float)value).floatValue())})</Code>.
- *
- * @param index the index of the element to set
- * @param value a {@link Float} instance that warps the new
- * <Code>float</Code> value for that element
- * @return a {@link Float} instance that wraps the previous
- * <Code>float</Code> value at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}
- * @throws ClassCastException if the given value is not a {@link Float}
- * @throws NullPointerException if the given value is <Code>null</COde>
- */
- public Object set(int index, Object value) {
- Float f = (Float)value;
- return new Float(setFloat(index, f.floatValue()));
- }
-
-
- /**
- * Adds the given <Code>float</COde> value to this list.
- *
- * @param value the <Code>float</COde> value to add
- * @return true, always
- */
- public boolean addFloat(float value) {
- ensureCapacity(_size+1);
- _data[_size++] = value;
- return true;
- }
-
- /**
- * Inserts the given <code>float</Code> value into this list at the
- * given index.
- *
- * @param index the index of the insertion
- * @param value the <Code>float</COde> value to insert at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than {@link #size()}
- */
- public void addFloat(int index, float value) {
- checkRangeIncludingEndpoint(index);
- ensureCapacity(_size+1);
- int numtomove = _size-index;
- System.arraycopy(_data,index,_data,index+1,numtomove);
- _data[index] = value;
- _size++;
- }
-
-
- /**
- * Invokes {@link #addFloat(int,float)
- * add(index, ((Float)value).floatValue())}.
- *
- * @param index the index of the insertion
- * @param value a {@link Float} instance that wraps the
- * <Code>float</COde> value to insert at that index
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than {@link #size()}
- * @throws ClassCastException if the given value is not a {@link Float}
- * @throws NullPointerException if the given value is <Code>null</COde>
- */
- public void add(int index, Object value) {
- addFloat(index,((Float)value).floatValue());
- }
-
- /**
- * Removes all <Code>float</Code> values from this list.
- */
- public void clear() {
- modCount++;
- _size = 0;
- }
-
- /**
- * Removes the <Code>float</Code> at the given index.
- *
- * @param index the index of the <Code>float</Code> value to remove
- * @return the removed <Code>float</Code> value
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}
- */
- public float removeFloatAt(int index) {
- checkRange(index);
- modCount++;
- float oldval = _data[index];
- int numtomove = _size - index - 1;
- if(numtomove > 0) {
- System.arraycopy(_data,index+1,_data,index,numtomove);
- }
- _size--;
- return oldval;
- }
-
- /**
- * Removes the first occurrence of the given <Code>float</Code> value
- * from this list.
- *
- * @param value the <Code>float</Code> value to remove
- * @return true if the first occurrence of that value was removed, or
- * false if this list did not contain that value
- */
- public boolean removeFloat(float value) {
- int index = indexOfFloat(value);
- if(-1 == index) {
- return false;
- } else {
- removeFloatAt(index);
- return true;
- }
- }
-
- /**
- * Removes the <Code>float</Code> at the given index.
- *
- * @param index the index of the <Code>float</Code> value to remove
- * @return a {@link Float} instance that wraps the removed
- * <Code>float</Code> value
- * @throws IndexOutOfBoundsException if the index is negative or
- * greater than or equal to {@link #size()}
- */
- public Object remove(int index) {
- return new Float(removeFloatAt(index));
- }
-
- /**
- * Ensures that the internal array is big enough to hold the specified
- * number of elements.
- *
- * @param mincap the minium capacity
- */
- public void ensureCapacity(int mincap) {
- modCount++;
- if(mincap > _data.length) {
- int newcap = (_data.length * 3)/2 + 1;
- float[] olddata = _data;
- _data = new float[newcap < mincap ? mincap : newcap];
- System.arraycopy(olddata,0,_data,0,_size);
- }
- }
-
- /**
- * Trims this list such that {@link #capacity()} is equal to
- * {@link #size()}.
- */
- public void trimToSize() {
- modCount++;
- if(_size < _data.length) {
- float[] olddata = _data;
- _data = new float[_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.writeFloat(_data[i]);
- }
- }
-
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- in.defaultReadObject();
- _data = new float[in.readInt()];
- for(int i=0;i<_size;i++) {
- _data[i] = in.readFloat();
- }
- }
-
- 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 float[] _data = null;
- private int _size = 0;
-}