add IntCollection, IntList, IntIterator, IntListIterator

deprecate various AbstractIntList implementations as a warning of impending change
(note that nothing in primitives.* has yet been released)


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130896 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Rodney Waldhoff 2003-01-04 15:00:57 +00:00
parent ceba1806c3
commit 8302eabc7b
8 changed files with 500 additions and 18 deletions

View File

@ -1,13 +1,13 @@
/*
* $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 $
* $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.7 2003/01/04 15:00:57 rwaldhoff Exp $
* $Revision: 1.7 $
* $Date: 2003/01/04 15:00:57 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* Copyright (c) 2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -72,8 +72,13 @@ package org.apache.commons.collections.primitives;
* 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 $
* @version $Revision: 1.7 $ $Date: 2003/01/04 15:00:57 $
* @author Rodney Waldhoff
*
* @deprecated This class will soon change to implement
* {@link IntList} and not {@link List}. Adapters
* between {@link List} and {@link IntList} will be
* provided.
*/
public abstract class AbstractIntArrayList extends AbstractIntList {

View File

@ -1,7 +1,7 @@
/*
* $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 $
* $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.5 2003/01/04 15:00:57 rwaldhoff Exp $
* $Revision: 1.5 $
* $Date: 2003/01/04 15:00:57 $
*
* ====================================================================
*
@ -85,8 +85,9 @@ import java.util.AbstractList;
* {@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 $
* @version $Revision: 1.5 $ $Date: 2003/01/04 15:00:57 $
* @author Rodney Waldhoff
* @deprecated To be replaced by {@link IntList}. If useful, an adapter to this interface could be provided.
*/
public abstract class AbstractIntList extends AbstractList {

View File

@ -1,13 +1,13 @@
/*
* $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 $
* $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.8 2003/01/04 15:00:57 rwaldhoff Exp $
* $Revision: 1.8 $
* $Date: 2003/01/04 15:00:57 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* Copyright (c) 2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -73,8 +73,12 @@ import java.io.Serializable;
* {@link java.util.ArrayList} of {@link Integer} values and allows for
* better compile-time type checking.<P>
*
* @version $Revision: 1.7 $ $Date: 2002/10/12 22:15:20 $
* @version $Revision: 1.8 $ $Date: 2003/01/04 15:00:57 $
* @author Rodney Waldhoff
* @deprecated This class will soon change to implement
* {@link IntList} and not {@link List}. Adapters
* between {@link List} and {@link IntList} will be
* provided.
*/
public class IntArrayList extends AbstractIntArrayList implements Serializable {

View File

@ -0,0 +1,159 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/IntCollection.java,v 1.1 2003/01/04 15:00:57 rwaldhoff Exp $
* $Revision: 1.1 $
* $Date: 2003/01/04 15:00:57 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 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;
/**
* A {@link java.util.Collection collection} of int values.
*
* @version $Revision: 1.1 $ $Date: 2003/01/04 15:00:57 $
* @author Rodney Waldhoff
*/
public interface IntCollection {
/**
* Ensures that I contain the specified element
* (optional operation).
*/
boolean add(int element);
/**
* {@link #add Adds} all of the elements in the
* specified collection to me
* (optional operation).
*/
boolean addAll(IntCollection c);
/**
* Removes all my elements
* (optional operation).
*/
void clear();
/**
* Returns <code>true</code> iff I contain
* the specified element.
*/
boolean contains(int element);
/**
* Returns <code>true</code> iff I contain
* all of the elements in the given collection.
*/
boolean containsAll(IntCollection c);
/**
* Compares the specified object with me for
* equality.
*/
boolean equals(Object o);
/**
* Returns my hash code value.
*/
int hashCode();
/**
* Returns true iff I contains no elements.
*/
boolean isEmpty();
/**
* Returns an iterator over all my elements.
*/
IntIterator iterator();
/**
* Removes the first occurrence of the
* specified element (optional operation).
*/
boolean removeElement(int element);
/**
* Removes from all the elements that are
* contained in the specified collection
* (optional operation).
*/
boolean removeAll(IntCollection c);
/**
* Retains only the elements that are
* contained in the specified collection
* (optional operation).
*/
boolean retainAll(IntCollection c);
/**
* Returns the number of elements I contain.
*/
int size();
/**
* Returns an array containing all my elements.
*/
int[] toArray();
/**
* Returns an array containing all of the elements
* in me, using the given array if it is large enough.
*/
int[] toArray(int[] a);
}

View File

@ -0,0 +1,93 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/IntIterator.java,v 1.1 2003/01/04 15:00:57 rwaldhoff Exp $
* $Revision: 1.1 $
* $Date: 2003/01/04 15:00:57 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 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;
/**
* A {@link java.util.Iterator iterator} over int values.
*
* @version $Revision: 1.1 $ $Date: 2003/01/04 15:00:57 $
* @author Rodney Waldhoff
*/
public interface IntIterator {
/**
* Returns <code>true</code> iff
* I have more elements.
*/
boolean hasNext();
/**
* Returns the next element in me.
* @throws NoSuchElementException if there is no next element
*/
int next();
/**
* Removes from my underlying collection the last
* element {@link #next returned} by me
* (optional operation).
* @throws UnsupportedOperationException if remove is not supported
* @throws IllegalStateException if {@link #next} has not yet been
* called, or {@link #remove} has already been called after
* the last call to {@link #next}.
*/
void remove();
}

View File

@ -0,0 +1,134 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/IntList.java,v 1.1 2003/01/04 15:00:57 rwaldhoff Exp $
* $Revision: 1.1 $
* $Date: 2003/01/04 15:00:57 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 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;
/**
* An ordered collection (a {@link java.util.List}) of int values.
*
* @version $Revision: 1.1 $ $Date: 2003/01/04 15:00:57 $
* @author Rodney Waldhoff
*/
public interface IntList {
/**
* Inserts the specified element at the specified position
* within me (optional operation).
*/
void add(int index, int element);
/**
* Returns the element at the specified position within
* me.
*/
Object get(int index);
/**
* Returns the index of the first occurrence
* of the specified element within me,
* or <code>-1</code> if I do not contain
* the this element.
*/
int indexOf(int element);
/**
* Returns the index of the last occurrence
* of the specified element within me,
* or -1 if I do not contain this element.
*/
int lastIndexOf(int element);
/**
* Returns a list iterator over all my elements.
*/
IntListIterator listIterator();
/**
* Returns a list iterator over my elements,
* starting at the specified position. The
* specified index indicates the first element
* that would be returned by an initial call
* to the next method. An initial call to the
* previous method would return the element
* with the specified index minus one.
*/
IntListIterator listIterator(int index);
/**
* Removes the element at the specified position in
* me (optional operation).
*/
int removeElementAt(int index);
/**
* Replaces the element at the specified
* position in me with the specified element
* (optional operation).
*/
int set(int index, int element);
/**
* Returns a view of the elements within me
* between the specified fromIndex, inclusive, and
* toIndex, exclusive.
*/
IntList subList(int fromIndex, int toIndex);
}

View File

@ -0,0 +1,80 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/IntListIterator.java,v 1.1 2003/01/04 15:00:57 rwaldhoff Exp $
* $Revision: 1.1 $
* $Date: 2003/01/04 15:00:57 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 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;
/**
* A {@link java.util.ListIterator list iterator} over int values.
*
* @version $Revision: 1.1 $ $Date: 2003/01/04 15:00:57 $
* @author Rodney Waldhoff
*/
public interface IntListIterator extends IntIterator {
void add(int element);
boolean hasNext();
boolean hasPrevious();
int next();
int nextIndex();
int previous();
int previousIndex();
void remove();
void set(int element);
}

View File

@ -1,7 +1,7 @@
/*
* $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 $
* $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.8 2003/01/04 15:00:57 rwaldhoff Exp $
* $Revision: 1.8 $
* $Date: 2003/01/04 15:00:57 $
*
* ====================================================================
*
@ -75,8 +75,14 @@ import java.io.Serializable;
* than a {@link java.util.ArrayList} and offers better compile-time type
* checking.
*
* @version $Revision: 1.7 $ $Date: 2002/10/12 22:15:20 $
* @version $Revision: 1.8 $ $Date: 2003/01/04 15:00:57 $
* @author Rodney Waldhoff
*
* @deprecated This class will soon change to implement
* {@link IntList} and not {@link List}. Adapters
* between {@link List} and {@link IntList} will be
* provided.
*
*/
public class UnsignedShortArrayList extends AbstractIntArrayList implements Serializable {