commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwaldh...@apache.org
Subject cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections/primitives TestArrayUnsignedShortList.java
Date Mon, 13 Jan 2003 21:52:29 GMT
rwaldhoff    2003/01/13 13:52:29

  Modified:    collections/src/java/org/apache/commons/collections/primitives
                        AbstractRandomAccessIntList.java ArrayIntList.java
                        ArrayUnsignedShortList.java IntCollection.java
                        IntIterator.java IntList.java package.html
               collections/src/java/org/apache/commons/collections/primitives/adapters
                        CollectionIntCollection.java
                        IntCollectionCollection.java
                        IntIteratorIterator.java
                        IntListIteratorListIterator.java IntListList.java
                        IteratorIntIterator.java ListIntList.java
                        ListIteratorIntListIterator.java
               collections/src/test/org/apache/commons/collections/primitives
                        TestArrayUnsignedShortList.java
  Log:
  javadocs
  add test
  
  Revision  Changes    Path
  1.9       +4 -4      jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractRandomAccessIntList.java
  
  Index: AbstractRandomAccessIntList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/AbstractRandomAccessIntList.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractRandomAccessIntList.java	13 Jan 2003 12:59:45 -0000	1.8
  +++ AbstractRandomAccessIntList.java	13 Jan 2003 21:52:28 -0000	1.9
  @@ -83,7 +83,7 @@
       // constructors
       //-------------------------------------------------------------------------
   
  -    /** Constructs any empty list. */
  +    /** Constructs an empty list. */
       protected AbstractRandomAccessIntList() { 
       }    
   
  @@ -95,7 +95,7 @@
        * @param that the non-<code>null</code> collection of <code>int</code>s

        *        to add
        * @throws NullPointerException if <i>that</i> is <code>null</code>
  -     * @throws UnsupportedOperationException if {@link #addAll} does
  +     * @throws UnsupportedOperationException if {@link #addAll addAll} does
        */
       protected AbstractRandomAccessIntList(IntCollection that) { 
           addAll(that);
  
  
  
  1.5       +4 -5      jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/ArrayIntList.java
  
  Index: ArrayIntList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/ArrayIntList.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ArrayIntList.java	13 Jan 2003 12:59:45 -0000	1.4
  +++ ArrayIntList.java	13 Jan 2003 21:52:28 -0000	1.5
  @@ -122,8 +122,7 @@
        * Removes the element at the specified position in 
        * (optional operation).  Any subsequent elements 
        * are shifted to the left, subtracting one from their 
  -     * indices.  Returns the element that was removed from
  -     * the list.
  +     * indices.  Returns the element that was removed.
        * 
        * @param index the index of the element to remove
        * @return the value of the element that was removed
  @@ -210,7 +209,7 @@
   
       /** 
        * Reduce my capacity, if necessary, to match my
  -     * current {@link #size}.
  +     * current {@link #size size}.
        */
       public void trimToSize() {
           incrModCount();
  
  
  
  1.4       +4 -5      jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/ArrayUnsignedShortList.java
  
  Index: ArrayUnsignedShortList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/ArrayUnsignedShortList.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ArrayUnsignedShortList.java	13 Jan 2003 12:59:45 -0000	1.3
  +++ ArrayUnsignedShortList.java	13 Jan 2003 21:52:28 -0000	1.4
  @@ -146,8 +146,7 @@
        * Removes the element at the specified position in 
        * (optional operation).  Any subsequent elements 
        * are shifted to the left, subtracting one from their 
  -     * indices.  Returns the element that was removed from
  -     * the list.
  +     * indices.  Returns the element that was removed.
        * By construction, the returned value will be 
        * between {@link #MIN_VALUE} and {@link #MAX_VALUE}, inclusive.
        * 
  @@ -242,7 +241,7 @@
   
       /** 
        * Reduce my capacity, if necessary, to match my
  -     * current {@link #size}.
  +     * current {@link #size size}.
        */
       public void trimToSize() {
           incrModCount();
  
  
  
  1.5       +38 -30    jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/IntCollection.java
  
  Index: IntCollection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/IntCollection.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- IntCollection.java	11 Jan 2003 21:28:02 -0000	1.4
  +++ IntCollection.java	13 Jan 2003 21:52:28 -0000	1.5
  @@ -72,7 +72,7 @@
       /** 
        * Ensures that I contain the specified element 
        * (optional operation).  Returns <code>true</code>
  -     * if I changed as a result of this call.
  +     * iff I changed as a result of this call.
        * <p/>
        * If a collection refuses to add the specified
        * element for any reason other than that it already contains
  @@ -108,7 +108,7 @@
       
       /** 
        * Removes all my elements (optional operation). 
  -     * This collection will be {@link #isEmpty empty} after this
  +     * I will be {@link #isEmpty empty} after this
        * method successfully returns.
        * 
        * @throws UnsupportedOperationException when this operation is not 
  @@ -148,6 +148,25 @@
        * @return an {@link IntIterator iterator} over all my elements.
        */
       IntIterator iterator();
  +    
  +    /** 
  +     * Removes all of my elements that are contained in the 
  +     * specified collection (optional operation). 
  +     * The behavior of this method is unspecified if 
  +     * the given collection is modified while this method
  +     * is executing.  Note that this includes the case
  +     * in which the given collection is this collection, 
  +     * and it is not empty.
  +     * 
  +     * @param c the collection of elements to remove
  +     * @return <code>true</code> iff I contained the at least one of the
  +     *         specified elements, in other words, returns <code>true</code>
  +     *         iff I changed as a result of this call
  +     * 
  +     * @throws UnsupportedOperationException when this operation is not 
  +     *         supported
  +     */
  +    boolean removeAll(IntCollection c);
        
       /** 
        * Removes a single occurrence of the specified element 
  @@ -163,24 +182,13 @@
       boolean removeElement(int element);
       
       /** 
  -     * Removes all of my elements that are contained in the 
  -     * specified collection (optional operation). 
  -     * 
  -     * @param c the collection of elements to remove
  -     * @return <code>true</code> iff I contained the at least one of the
  -     *         specified elements,  in other words, iff I changed as a result 
  -     *         of this call
  -     * 
  -     * @throws UnsupportedOperationException when this operation is not 
  -     *         supported
  -     */
  -    boolean removeAll(IntCollection c);
  -    
  -    /** 
        * Removes all of my elements that are <i>not</i> contained in the 
        * specified collection (optional operation). 
  -     * (In other words, retains only my elements that are 
  -     * contained in the specified collection. 
  +     * (In other words, retains <i>only</i> my elements that are 
  +     * contained in the specified collection.)
  +     * The behavior of this method is unspecified if 
  +     * the given collection is modified while this method
  +     * is executing.
        * 
        * @param c the collection of elements to retain
        * @return <code>true</code> iff I changed as a result 
  @@ -199,15 +207,15 @@
       
       /** 
        * Returns an array containing all of my elements.
  -     * The length of the returned array should be equal
  -     * to the my {@link #size size}.
  +     * The length of the returned array will be equal
  +     * to my {@link #size size}.
        * <p/>
  -     * The returned array will be independent of this
  -     * collection, so that callers may modify that 
  +     * The returned array will be independent of me, 
  +     * so that callers may modify that 
        * returned array without modifying this collection.
        * <p/>
  -     * When this collection guarantees the order in which 
  -     * elements are returned by an {@link #iterator},
  +     * When I guarantee the order in which 
  +     * elements are returned by an {@link #iterator iterator},
        * the returned array will contain elements in the
        * same order.
        * 
  @@ -222,12 +230,12 @@
        * larger than the number of elements I contain, 
        * values outside of my range will be unchanged.
        * <p/>
  -     * The returned array will be independent of this
  -     * collection, so that callers may modify that 
  +     * The returned array will be independent of me, 
  +     * so that callers may modify that 
        * returned array without modifying this collection.
        * <p/>
  -     * When this collection guarantees the order in which 
  -     * elements are returned by an {@link #iterator},
  +     * When I guarantee the order in which 
  +     * elements are returned by an {@link #iterator iterator},
        * the returned array will contain elements in the
        * same order.
        * 
  
  
  
  1.5       +4 -4      jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/IntIterator.java
  
  Index: IntIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/IntIterator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- IntIterator.java	11 Jan 2003 21:34:39 -0000	1.4
  +++ IntIterator.java	13 Jan 2003 21:52:28 -0000	1.5
  @@ -72,8 +72,8 @@
       /** 
        * Returns <code>true</code> iff I have more elements. 
        * (In other words, returns <code>true</code> iff 
  -     * a call to {@link #next next} will return an element
  -     * rather than throwing an exception.)
  +     * a subsequent call to {@link #next next} will return 
  +     * an element rather than throwing an exception.)
        * 
        * @return <code>true</code> iff I have more elements
        */
  
  
  
  1.13      +22 -15    jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/IntList.java
  
  Index: IntList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/IntList.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- IntList.java	13 Jan 2003 12:59:45 -0000	1.12
  +++ IntList.java	13 Jan 2003 21:52:28 -0000	1.13
  @@ -72,7 +72,7 @@
       /** 
        * Appends the specified element to the end of me
        * (optional operation).  Returns <code>true</code>
  -     * if I changed as a result of this call.
  +     * iff I changed as a result of this call.
        * <p/>
        * If a collection refuses to add the specified
        * element for any reason other than that it already contains
  @@ -118,7 +118,7 @@
        * 
        * @param index the index at which to insert the first element from 
        *        the specified collection
  -     * @param collection the {@link IntCollection} of elements to add 
  +     * @param collection the {@link IntCollection IntCollection} of elements to add 
        * @return <code>true</code> iff I changed as a result of this call
        * 
        * @throws UnsupportedOperationException when this operation is not 
  @@ -131,8 +131,8 @@
        * Returns <code>true</code> iff <i>that</i> is an <code>IntList</code>
        * that contains the same elements in the same order as me.
        * In other words, returns <code>true</code> iff <i>that</i>
is
  -     * an <code>IntList</code> that has the same {@link #size} as me,
  -     * and for which the elements returned that its 
  +     * an <code>IntList</code> that has the same {@link #size size} as me,
  +     * and for which the elements returned by its 
        * {@link IntList#iterator iterator} are equal (<code>==</code>) to
        * the corresponding elements within me.
        * (This contract ensures that this method works properly across 
  @@ -145,8 +145,8 @@
       boolean equals(Object that);
       
       /** 
  -     * Returns the element at the specified position within 
  -     * me. 
  +     * Returns the value of the element at the specified position 
  +     * within me. 
        * 
        * @param index the index of the element to return
        * @return the value of the element at the specified position
  @@ -159,13 +159,14 @@
        * <p />
        * The hash code of an <code>IntList</code> is defined to be the
        * result of the following calculation:
  -     * <pre>int hash = 1;
  +     * <pre> int hash = 1;
        * for(IntIterator iter = iterator(); iter.hasNext(); ) {
        *   hash = 31*hash + iter.next();
        * }</pre>
        * <p />
        * This contract ensures that this method is consistent with 
  -     * {@link #equals} and with the {@link java.util.List#hashCode hashCode}
  +     * {@link #equals equals} and with the 
  +     * {@link java.util.List#hashCode hashCode}
        * method of a {@link java.util.List List} of {@link Integer}s. 
        * 
        * @return my hash code
  @@ -185,6 +186,13 @@
       int indexOf(int element);
        
       /** 
  +     * Returns an {@link IntIterator iterator} over all my elements,
  +     * in the appropriate sequence.
  +     * @return an {@link IntIterator iterator} over all my elements.
  +     */
  +    IntIterator iterator();
  +
  +    /** 
        * Returns the index of the last occurrence 
        * of the specified element within me, 
        * or -1 if I do not contain the element. 
  @@ -205,7 +213,7 @@
       /** 
        * Returns a 
        * {@link IntListIterator bidirectional iterator}
  -     * over my elements, in the appropriate sequence, 
  +     * over all my elements, in the appropriate sequence, 
        * starting at the specified position. The 
        * specified <i>index</i> indicates the first 
        * element that would be returned by an initial 
  @@ -224,8 +232,7 @@
        * Removes the element at the specified position in 
        * (optional operation).  Any subsequent elements 
        * are shifted to the left, subtracting one from their 
  -     * indices.  Returns the element that was removed from
  -     * the list.
  +     * indices.  Returns the element that was removed.
        * 
        * @param index the index of the element to remove
        * @return the value of the element that was removed
  @@ -254,14 +261,14 @@
       /** 
        * Returns a view of the elements within me 
        * between the specified <i>fromIndex</i>, inclusive, and 
  -     * <i>toIndex</i>, exclusive.  The returned {@link IntList}
  +     * <i>toIndex</i>, exclusive.  The returned <code>IntList</code>
        * is backed by me, so that any changes in 
        * the returned list are reflected in me, and vice-versa.
        * The returned list supports all of the optional operations
        * that I support.
        * <p/>
        * Note that when <code><i>fromIndex</i> == <i>toIndex</i></code>,
  -     * the returned list is empty, and when 
  +     * the returned list is initially empty, and when 
        * <code><i>fromIndex</i> == 0 && <i>toIndex</i>
== {@link #size() size()}</code>
        * the returned list is my "improper" sublist, containing all my elements.
        * <p/>
  
  
  
  1.6       +5 -5      jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/package.html
  
  Index: package.html
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/package.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- package.html	11 Jan 2003 21:28:02 -0000	1.5
  +++ package.html	13 Jan 2003 21:52:28 -0000	1.6
  @@ -60,16 +60,16 @@
      </head>
      <body>
         <p>
  -         Collections that are based upon primitive
  -         types. Generally these extensions offer memory 
  +         Collections of primitive values. 
  +         Generally these extensions offer memory 
            and performance improvements over the 
            <code>Object</code> wrapped alternative.
         </p>
         <p>
  -      	 The package provides (or will provide) versions of 
  +      	 The package provides versions of 
         	 the major collections framework interfaces
         	 (<code>Collection</code>, <code>List</code>, 
  -      	 <code>Map</code>, <code>Set</code>) and their 
  +      	 <code>Map</code>, <code>Set</code>, etc.) and their 
         	 helpers (<code>Iterator</code>, <code>ListIterator</code>,

         	 etc) for each primitive type, and various concrete 
         	 implementations of these.
  
  
  
  1.3       +44 -9     jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/CollectionIntCollection.java
  
  Index: CollectionIntCollection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/CollectionIntCollection.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CollectionIntCollection.java	11 Jan 2003 21:28:03 -0000	1.2
  +++ CollectionIntCollection.java	13 Jan 2003 21:52:28 -0000	1.3
  @@ -63,14 +63,39 @@
   import org.apache.commons.collections.primitives.IntIterator;
   
   /**
  - * Adapts a {@link java.lang.Number Number} valued
  + * Adapts a {@link java.lang.Number Number}-valued
    * {@link java.util.Collection Collection} to the
  - * {@link IntCollection} interface.
  - *
  + * {@link IntCollection IntCollection} interface.
  + * <p />
  + * This implementation delegates most methods
  + * to the provided {@link Collection Collection} 
  + * implementation in the "obvious" way.
  + * 
  + * @since Commons Collections 2.2
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff 
    */
   public class CollectionIntCollection implements IntCollection {
  +    /**
  +     * Create an {@link IntCollection IntCollection} wrapping
  +     * the specified {@link Collection Collection}.  When
  +     * the given <i>collection</i> is <code>null</code>,
  +     * returns <code>null</code>.
  +     * 
  +     * @param collection the (possibly <code>null</code>) {@link Collection}
to wrap
  +     * @return an {@link IntCollection IntCollection} wrapping the given 
  +     *         <i>collection</i>, or <code>null</code> when <i>collection</i>
is
  +     *         <code>null</code>.
  +     */
  +    public static IntCollection wrap(Collection collection) {
  +        return null == collection ? null : new CollectionIntCollection(collection);
  +    }
  +    
  +    /**
  +     * Creates an {@link IntCollection IntCollection} wrapping
  +     * the specified {@link Collection Collection}.
  +     * @see #wrap
  +     */
       public CollectionIntCollection(Collection collection) {
           _collection = collection;
       }
  @@ -95,6 +120,13 @@
           return _collection.containsAll(IntCollectionCollection.wrap(c));
       }        
       
  +    /**
  +     * If <i>that</i> is an {@link IntCollection IntCollection}, 
  +     * it is {@link IntCollectionCollection#wrap wrapped} and
  +     * compared to my underlying {@link Collection Collection}, otherwise
  +     * this method simply delegates to my underlying 
  +     * {@link Collection Collection}.
  +     */
       public boolean equals(Object that) {
           if(that instanceof IntCollection) {
               return _collection.equals(IntCollectionCollection.wrap((IntCollection)that));
  @@ -115,6 +147,13 @@
           return _collection.isEmpty();
       }
       
  +    /**
  +     * {@link IteratorIntIterator#wrap wraps} the 
  +     * {@link java.util.Iterator Iterator}
  +     * returned by my underlying 
  +     * {@link Collection Collection}, 
  +     * if any.
  +     */
       public IntIterator iterator() {
           return IteratorIntIterator.wrap(_collection.iterator());
       }
  @@ -153,10 +192,6 @@
               dest[i] = ((Number)(src[i])).intValue();
           }
           return dest;
  -    }
  -    
  -    public static IntCollection wrap(Collection collection) {
  -        return null == collection ? null : new CollectionIntCollection(collection);
       }
       
       private Collection _collection = null;
  
  
  
  1.3       +47 -9     jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntCollectionCollection.java
  
  Index: IntCollectionCollection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntCollectionCollection.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IntCollectionCollection.java	11 Jan 2003 21:28:03 -0000	1.2
  +++ IntCollectionCollection.java	13 Jan 2003 21:52:28 -0000	1.3
  @@ -64,14 +64,41 @@
   import org.apache.commons.collections.primitives.IntCollection;
   
   /**
  - * Adapts an {@link IntCollection} to the
  - * {@link java.util.Collection Collection} interface.
  - *
  + * Adapts an {@link IntCollection IntCollection}
  + * to the {@link java.util.Collection Collection}
  + * interface.
  + * <p />
  + * This implementation delegates most methods
  + * to the provided {@link IntCollection IntCollection} 
  + * implementation in the "obvious" way.
  + * 
  + * @since Commons Collections 2.2
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff 
    */
   public class IntCollectionCollection implements Collection {
       
  +    /**
  +     * Create a {@link Collection Collection} wrapping
  +     * the specified {@link IntCollection IntCollection}.  When
  +     * the given <i>collection</i> is <code>null</code>,
  +     * returns <code>null</code>.
  +     * 
  +     * @param collection the (possibly <code>null</code>) 
  +     *        {@link IntCollection IntCollection} to wrap
  +     * @return a {@link Collection Collection} wrapping the given 
  +     *         <i>collection</i>, or <code>null</code> when <i>collection</i>
is
  +     *         <code>null</code>.
  +     */
  +    public static Collection wrap(IntCollection collection) {
  +        return null == collection ? null : new IntCollectionCollection(collection);
  +    }
  +    
  +    /**
  +     * Creates a {@link Collection Collection} wrapping
  +     * the specified {@link IntCollection IntCollection}.
  +     * @see #wrap
  +     */
       public IntCollectionCollection(IntCollection collection) {
           _collection = collection;
       }
  @@ -97,6 +124,14 @@
           return _collection.containsAll(CollectionIntCollection.wrap(c));
       }        
       
  +    /**
  +     * If <i>that</i> is a {@link Collection Collection}, 
  +     * it is {@link CollectionIntCollection#wrap wrapped} and
  +     * compared to my underlying 
  +     * {@link org.apache.commons.collections.primitives.IntCollection IntCollection},
  +     * otherwise this method simply delegates to my underlying 
  +     * <code>IntCollection</code>.
  +     */
       public boolean equals(Object that) {
           if(that instanceof Collection) {
               try {
  @@ -123,6 +158,13 @@
           return _collection.isEmpty();
       }
       
  +    /**
  +     * {@link IntIteratorIterator#wrap wraps} the 
  +     * {@link org.apache.commons.collections.primitives.IntIterator IntIterator}
  +     * returned by my underlying 
  +     * {@link IntCollection IntCollection}, 
  +     * if any.
  +     */
       public Iterator iterator() {
           return IntIteratorIterator.wrap(_collection.iterator());
       }
  @@ -165,10 +207,6 @@
           }
   
           return A;
  -    }
  -    
  -    public static Collection wrap(IntCollection collection) {
  -        return null == collection ? null : new IntCollectionCollection(collection);
       }
       
       private IntCollection _collection = null;
  
  
  
  1.3       +29 -7     jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntIteratorIterator.java
  
  Index: IntIteratorIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntIteratorIterator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IntIteratorIterator.java	11 Jan 2003 21:28:03 -0000	1.2
  +++ IntIteratorIterator.java	13 Jan 2003 21:52:28 -0000	1.3
  @@ -62,14 +62,40 @@
   import org.apache.commons.collections.primitives.IntIterator;
   
   /**
  - * Adapts an {@link IntIterator} to the
  + * Adapts an {@link IntIterator IntIterator} to the
    * {@link java.util.Iterator Iterator} interface.
  + * <p />
  + * This implementation delegates most methods
  + * to the provided {@link IntIterator IntIterator} 
  + * implementation in the "obvious" way.
    *
  + * @since Commons Collections 2.2
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff 
    */
   public class IntIteratorIterator implements Iterator {
       
  +    /**
  +     * Create an {@link Iterator Iterator} wrapping
  +     * the specified {@link IntIterator IntIterator}.  When
  +     * the given <i>iterator</i> is <code>null</code>,
  +     * returns <code>null</code>.
  +     * 
  +     * @param iterator the (possibly <code>null</code>) 
  +     *        {@link IntIterator IntIterator} to wrap
  +     * @return an {@link Iterator Iterator} wrapping the given 
  +     *         <i>iterator</i>, or <code>null</code> when <i>iterator</i>
is
  +     *         <code>null</code>.
  +     */
  +    public static Iterator wrap(IntIterator iterator) {
  +        return null == iterator ? null : new IntIteratorIterator(iterator);
  +    }
  +    
  +    /**
  +     * Creates an {@link Iterator Iterator} wrapping
  +     * the specified {@link IntIterator IntIterator}.
  +     * @see #wrap
  +     */
       public IntIteratorIterator(IntIterator iterator) {
           _iterator = iterator;
       }
  @@ -84,10 +110,6 @@
       
       public void remove() {
           _iterator.remove();
  -    }
  -    
  -    public static Iterator wrap(IntIterator iterator) {
  -        return null == iterator ? null : new IntIteratorIterator(iterator);
       }
       
       private IntIterator _iterator = null;
  
  
  
  1.4       +32 -10    jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntListIteratorListIterator.java
  
  Index: IntListIteratorListIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntListIteratorListIterator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IntListIteratorListIterator.java	11 Jan 2003 21:28:03 -0000	1.3
  +++ IntListIteratorListIterator.java	13 Jan 2003 21:52:28 -0000	1.4
  @@ -59,17 +59,43 @@
   
   import java.util.ListIterator;
   
  -import org.apache.commons.collections.primitives.*;
  +import org.apache.commons.collections.primitives.IntListIterator;
   
   /**
  - * Adapts an {@link IntListIterator} to the
  - * {@link java.util.ListIterator ListIterator} interface.
  + * Adapts an {@link IntListIterator IntListIterator} to the
  + * {@link ListIterator ListIterator} interface.
  + * <p />
  + * This implementation delegates most methods
  + * to the provided {@link IntListIterator IntListIterator} 
  + * implementation in the "obvious" way.
    *
  + * @since Commons Collections 2.2
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff 
    */
   public class IntListIteratorListIterator implements ListIterator {
       
  +    /**
  +     * Create a {@link ListIterator ListIterator} wrapping
  +     * the specified {@link IntListIterator IntListIterator}.  When
  +     * the given <i>iterator</i> is <code>null</code>,
  +     * returns <code>null</code>.
  +     * 
  +     * @param iterator the (possibly <code>null</code>) 
  +     *        {@link IntListIterator IntListIterator} to wrap
  +     * @return a {@link ListIterator ListIterator} wrapping the given 
  +     *         <i>iterator</i>, or <code>null</code> when <i>iterator</i>
is
  +     *         <code>null</code>.
  +     */
  +    public static ListIterator wrap(IntListIterator iterator) {
  +        return null == iterator ? null : new IntListIteratorListIterator(iterator);
  +    }
  +    
  +    /**
  +     * Creates an {@link ListIterator ListIterator} wrapping
  +     * the specified {@link IntListIterator IntListIterator}.
  +     * @see #wrap
  +     */
       public IntListIteratorListIterator(IntListIterator iterator) {
           _iterator = iterator;
       }
  @@ -109,11 +135,7 @@
       public void remove() {
           _iterator.remove();
       }
  -      
  -    public static ListIterator wrap(IntListIterator iterator) {
  -        return null == iterator ? null : new IntListIteratorListIterator(iterator);
  -    }
  -    
  +          
       private IntListIterator _iterator = null;
   
   }
  
  
  
  1.3       +51 -8     jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntListList.java
  
  Index: IntListList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntListList.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IntListList.java	11 Jan 2003 21:28:03 -0000	1.2
  +++ IntListList.java	13 Jan 2003 21:52:28 -0000	1.3
  @@ -64,14 +64,40 @@
   import org.apache.commons.collections.primitives.IntList;
   
   /**
  - * Adapts an {@link IntList} to the
  - * {@link java.util.List List} interface.
  + * Adapts an {@link IntList IntList} to the
  + * {@link List List} interface.
  + * <p />
  + * This implementation delegates most methods
  + * to the provided {@link IntList IntList} 
  + * implementation in the "obvious" way.
    *
  + * @since Commons Collections 2.2
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff 
    */
   public class IntListList extends IntCollectionCollection implements List {
       
  +    /**
  +     * Create a {@link List List} wrapping
  +     * the specified {@link IntList IntList}.  When
  +     * the given <i>list</i> is <code>null</code>,
  +     * returns <code>null</code>.
  +     * 
  +     * @param list the (possibly <code>null</code>) 
  +     *        {@link IntList IntList} to wrap
  +     * @return a {@link List List} wrapping the given 
  +     *         <i>list</i>, or <code>null</code> when <i>list</i>
is
  +     *         <code>null</code>.
  +     */
  +    public static List wrap(IntList list) {
  +        return null == list ? null : new IntListList(list);
  +    }
  +
  +    /**
  +     * Creates a {@link List List} wrapping
  +     * the specified {@link IntList IntList}.
  +     * @see #wrap
  +     */
       public IntListList(IntList list) {
           super(list);        
           _list = list;
  @@ -97,10 +123,24 @@
           return _list.lastIndexOf(((Number)element).intValue());
       }
   
  +    /**
  +     * {@link IntListIteratorListIterator#wrap wraps} the 
  +     * {@link org.apache.commons.collections.primitives.IntListIterator IntListIterator}
  +     * returned by my underlying 
  +     * {@link IntList IntList}, 
  +     * if any.
  +     */
       public ListIterator listIterator() {
           return IntListIteratorListIterator.wrap(_list.listIterator());
       }
   
  +    /**
  +     * {@link IntListIteratorListIterator#wrap wraps} the 
  +     * {@link org.apache.commons.collections.primitives.IntListIterator IntListIterator}
  +     * returned by my underlying 
  +     * {@link IntList IntList}, 
  +     * if any.
  +     */
       public ListIterator listIterator(int index) {
           return IntListIteratorListIterator.wrap(_list.listIterator(index));
       }
  @@ -117,6 +157,13 @@
           return IntListList.wrap(_list.subList(fromIndex,toIndex));
       }
   
  +    /**
  +     * If <i>that</i> is a {@link List List}, 
  +     * it is {@link ListIntList#wrap wrapped} and
  +     * compared to my underlying 
  +     * {@link org.apache.commons.collections.primitives.IntList IntList},
  +     * otherwise this method simply delegates to my parent implementation.
  +     */
       public boolean equals(Object that) {
           if(that instanceof List) {
               try {
  @@ -131,10 +178,6 @@
           }
       }
       
  -    public static List wrap(IntList list) {
  -        return null == list ? null : new IntListList(list);
  -    }
  -
       private IntList _list = null;
   
   }
  
  
  
  1.3       +31 -9     jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IteratorIntIterator.java
  
  Index: IteratorIntIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IteratorIntIterator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IteratorIntIterator.java	11 Jan 2003 21:28:03 -0000	1.2
  +++ IteratorIntIterator.java	13 Jan 2003 21:52:28 -0000	1.3
  @@ -63,15 +63,41 @@
   
   /**
    * Adapts a {@link java.lang.Number Number}-valued 
  - * {@link java.util.Iterator Iterator} 
  - * to the {@link IntIterator} interface.
  + * {@link Iterator Iterator} 
  + * to the {@link IntIterator IntIterator} 
  + * interface.
  + * <p />
  + * This implementation delegates most methods
  + * to the provided {@link Iterator Iterator} 
  + * implementation in the "obvious" way.
    *
  + * @since Commons Collections 2.2
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff 
  - *  
    */
   public class IteratorIntIterator implements IntIterator {
       
  +    /**
  +     * Create an {@link IntIterator IntIterator} wrapping
  +     * the specified {@link Iterator Iterator}.  When
  +     * the given <i>iterator</i> is <code>null</code>,
  +     * returns <code>null</code>.
  +     * 
  +     * @param iterator the (possibly <code>null</code>) 
  +     *        {@link Iterator Iterator} to wrap
  +     * @return an {@link IntIterator IntIterator} wrapping the given 
  +     *         <i>iterator</i>, or <code>null</code> when <i>iterator</i>
is
  +     *         <code>null</code>.
  +     */
  +    public static IntIterator wrap(Iterator iterator) {
  +        return null == iterator ? null : new IteratorIntIterator(iterator);
  +    }
  +   
  +    /**
  +     * Creates an {@link IntIterator IntIterator} wrapping
  +     * the specified {@link Iterator Iterator}.
  +     * @see #wrap
  +     */
       public IteratorIntIterator(Iterator iterator) {
           _iterator = iterator;
       }
  @@ -88,10 +114,6 @@
           _iterator.remove();
       }
       
  -    public static IntIterator wrap(Iterator iterator) {
  -        return null == iterator ? null : new IteratorIntIterator(iterator);
  -    }
  -
       private Iterator _iterator = null;
   
   }
  
  
  
  1.4       +52 -9     jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/ListIntList.java
  
  Index: ListIntList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/ListIntList.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ListIntList.java	11 Jan 2003 21:28:03 -0000	1.3
  +++ ListIntList.java	13 Jan 2003 21:52:28 -0000	1.4
  @@ -59,19 +59,45 @@
   
   import java.util.List;
   
  -import org.apache.commons.collections.primitives.*;
   import org.apache.commons.collections.primitives.IntCollection;
   import org.apache.commons.collections.primitives.IntList;
  +import org.apache.commons.collections.primitives.IntListIterator;
   
   /**
  - * Adapts a {@link Number}-valued {@link java.util.List List} 
  - * to the {@link IntList} interface.
  + * Adapts a {@link Number}-valued {@link List List} 
  + * to the {@link IntList IntList} interface.
  + * <p />
  + * This implementation delegates most methods
  + * to the provided {@link List List} 
  + * implementation in the "obvious" way.
    *
  + * @since Commons Collections 2.2
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff 
    */
   public class ListIntList extends CollectionIntCollection implements IntList {
       
  +    /**
  +     * Create an {@link IntList IntList} wrapping
  +     * the specified {@link List List}.  When
  +     * the given <i>list</i> is <code>null</code>,
  +     * returns <code>null</code>.
  +     * 
  +     * @param list the (possibly <code>null</code>) 
  +     *        {@link List List} to wrap
  +     * @return a {@link IntList IntList} wrapping the given 
  +     *         <i>list</i>, or <code>null</code> when <i>list</i>
is
  +     *         <code>null</code>.
  +     */
  +    public static IntList wrap(List list) {
  +        return null == list ? null : new ListIntList(list);
  +    }
  +
  +    /**
  +     * Creates an {@link IntList IntList} wrapping
  +     * the specified {@link List List}.
  +     * @see #wrap
  +     */
       public ListIntList(List list) {
           super(list);        
           _list = list;
  @@ -97,10 +123,24 @@
           return _list.lastIndexOf(new Integer(element));
       }
   
  +    /**
  +     * {@link ListIteratorIntListIterator#wrap wraps} the 
  +     * {@link IntList IntList} 
  +     * returned by my underlying 
  +     * {@link IntListIterator IntListIterator},
  +     * if any.
  +     */
       public IntListIterator listIterator() {
           return ListIteratorIntListIterator.wrap(_list.listIterator());
       }
   
  +    /**
  +     * {@link ListIteratorIntListIterator#wrap wraps} the 
  +     * {@link IntList IntList} 
  +     * returned by my underlying 
  +     * {@link IntListIterator IntListIterator},
  +     * if any.
  +     */
       public IntListIterator listIterator(int index) {
           return ListIteratorIntListIterator.wrap(_list.listIterator(index));
       }
  @@ -117,6 +157,13 @@
           return ListIntList.wrap(_list.subList(fromIndex,toIndex));
       }
   
  +    /**
  +     * If <i>that</i> is an {@link IntList IntList}, 
  +     * it is {@link IntListList#wrap wrapped} and
  +     * compared to my underlying 
  +     * {@link List List},
  +     * otherwise this method simply delegates to my parent implementation.
  +     */
       public boolean equals(Object that) {
           if(that instanceof IntList) {
               return _list.equals(IntListList.wrap((IntList)that));
  @@ -125,10 +172,6 @@
           }
       }
           
  -    public static IntList wrap(List list) {
  -        return null == list ? null : new ListIntList(list);
  -    }
  -
       private List _list = null;
   
   }
  
  
  
  1.4       +31 -9     jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/ListIteratorIntListIterator.java
  
  Index: ListIteratorIntListIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/ListIteratorIntListIterator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ListIteratorIntListIterator.java	11 Jan 2003 21:28:03 -0000	1.3
  +++ ListIteratorIntListIterator.java	13 Jan 2003 21:52:28 -0000	1.4
  @@ -59,17 +59,43 @@
   
   import java.util.ListIterator;
   
  -import org.apache.commons.collections.primitives.*;
  +import org.apache.commons.collections.primitives.IntListIterator;
   
   /**
  - * Adapts a {@link Number}-valued {@link java.util.ListIterator} 
  - * to the {@link IntListIterator} interface.
  + * Adapts a {@link Number}-valued {@link ListIterator ListIterator} 
  + * to the {@link IntListIterator IntListIterator} interface.
  + * <p />
  + * This implementation delegates most methods
  + * to the provided {@link IntListIterator IntListIterator} 
  + * implementation in the "obvious" way.
    *
  + * @since Commons Collections 2.2
    * @version $Revision$ $Date$
    * @author Rodney Waldhoff 
    */
   public class ListIteratorIntListIterator implements IntListIterator {
  +        
  +    /**
  +     * Create an {@link IntListIterator IntListIterator} wrapping
  +     * the specified {@link ListIterator ListIterator}.  When
  +     * the given <i>iterator</i> is <code>null</code>,
  +     * returns <code>null</code>.
  +     * 
  +     * @param iterator the (possibly <code>null</code>) 
  +     *        {@link ListIterator ListIterator} to wrap
  +     * @return an {@link IntListIterator IntListIterator} wrapping the given 
  +     *         <i>iterator</i>, or <code>null</code> when <i>iterator</i>
is
  +     *         <code>null</code>.
  +     */
  +    public static IntListIterator wrap(ListIterator iterator) {
  +        return null == iterator ? null : new ListIteratorIntListIterator(iterator);
  +    }    
       
  +    /**
  +     * Creates an {@link IntListIterator IntListIterator} wrapping
  +     * the specified {@link ListIterator ListIterator}.
  +     * @see #wrap
  +     */
       public ListIteratorIntListIterator(ListIterator iterator) {
           _iterator = iterator;
       }
  @@ -110,10 +136,6 @@
           _iterator.remove();
       }
         
  -    public static IntListIterator wrap(ListIterator iterator) {
  -        return null == iterator ? null : new ListIteratorIntListIterator(iterator);
  -    }
  -    
       private ListIterator _iterator = null;
   
   }
  
  
  
  1.6       +21 -2     jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestArrayUnsignedShortList.java
  
  Index: TestArrayUnsignedShortList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestArrayUnsignedShortList.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestArrayUnsignedShortList.java	12 Jan 2003 15:23:20 -0000	1.5
  +++ TestArrayUnsignedShortList.java	13 Jan 2003 21:52:28 -0000	1.6
  @@ -113,4 +113,23 @@
       public void testZeroInitialCapacityIsValid() {
           ArrayUnsignedShortList list = new ArrayUnsignedShortList(0);
       }
  +    
  +    public void testIllegalArgumentExceptionWhenElementOutOfRange() {
  +        ArrayUnsignedShortList list = new ArrayUnsignedShortList();
  +        list.add(ArrayUnsignedShortList.MIN_VALUE);
  +        list.add(ArrayUnsignedShortList.MAX_VALUE);
  +        try {
  +            list.add(-1);
  +            fail("Expected IllegalArgumentException");
  +        } catch(IllegalArgumentException e) {
  +            // expected
  +        }
  +        try {
  +            list.add(ArrayUnsignedShortList.MAX_VALUE+1);
  +            fail("Expected IllegalArgumentException");
  +        } catch(IllegalArgumentException e) {
  +            // expected
  +        }
  +    }
  +
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message