You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rw...@apache.org on 2003/05/20 19:05:29 UTC

cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections/primitives IntCollections.java

rwaldhoff    2003/05/20 10:05:28

  Modified:    collections/src/java/org/apache/commons/collections/primitives/decorators
                        ProxyIntIterator.java ProxyIntListIterator.java
               collections/src/test/org/apache/commons/collections/primitives/decorators
                        TestAll.java
               collections/src/test/org/apache/commons/collections/primitives
                        TestAll.java
  Added:       collections/src/test/org/apache/commons/collections/primitives/decorators
                        TestUnmodifiableIntIterator.java
                        BaseUnmodifiableIntIteratorTest.java
                        TestUnmodifiableIntListIterator.java
                        BaseUnmodifiableIntListIteratorTest.java
               collections/src/test/org/apache/commons/collections/primitives
                        TestIntCollections.java
               collections/src/java/org/apache/commons/collections/primitives
                        IntCollections.java
  Log:
  * add IntCollections and test
  * add additional primitives.decorators.* tests
  
  Revision  Changes    Path
  1.2       +2 -6      jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/decorators/ProxyIntIterator.java
  
  Index: ProxyIntIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/decorators/ProxyIntIterator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProxyIntIterator.java	20 May 2003 00:44:11 -0000	1.1
  +++ ProxyIntIterator.java	20 May 2003 17:05:27 -0000	1.2
  @@ -78,9 +78,5 @@
           return getIterator().next();
       }
   
  -    public void remove() {
  -        getIterator().remove();
  -    }
  -
       protected abstract IntIterator getIterator();    
   }
  
  
  
  1.2       +2 -10     jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/decorators/ProxyIntListIterator.java
  
  Index: ProxyIntListIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/decorators/ProxyIntListIterator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProxyIntListIterator.java	20 May 2003 00:44:11 -0000	1.1
  +++ ProxyIntListIterator.java	20 May 2003 17:05:28 -0000	1.2
  @@ -71,10 +71,6 @@
       ProxyIntListIterator() {
       }
       
  -    public void add(int element) {
  -        getListIterator().add(element);
  -    }
  -
       public boolean hasPrevious() {
           return getListIterator().hasPrevious();
       }
  @@ -89,10 +85,6 @@
   
       public int previousIndex() {
           return getListIterator().previousIndex();
  -    }
  -
  -    public void set(int element) {
  -        getListIterator().set(element);
       }
   
       protected final IntIterator getIterator() {
  
  
  
  1.4       +4 -2      jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/decorators/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/decorators/TestAll.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestAll.java	20 May 2003 00:44:11 -0000	1.3
  +++ TestAll.java	20 May 2003 17:05:28 -0000	1.4
  @@ -81,6 +81,8 @@
           suite.addTest(TestBaseProxyIntCollection.suite());
           suite.addTest(TestBaseProxyIntList.suite());
           suite.addTest(TestUnmodifiableIntList.suite());
  +        suite.addTest(TestUnmodifiableIntIterator.suite());
  +        suite.addTest(TestUnmodifiableIntListIterator.suite());
   
           return suite;
       }
  
  
  
  1.1                  jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/decorators/TestUnmodifiableIntIterator.java
  
  Index: TestUnmodifiableIntIterator.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/decorators/TestUnmodifiableIntIterator.java,v 1.1 2003/05/20 17:05:28 rwaldhoff Exp $
   * ====================================================================
   * 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments 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 Software Foundation.
   *
   * 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.decorators;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  import org.apache.commons.collections.primitives.IntIterator;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/05/20 17:05:28 $
   * @author Rodney Waldhoff
   */
  public class TestUnmodifiableIntIterator extends BaseUnmodifiableIntIteratorTest {
  
      // conventional
      // ------------------------------------------------------------------------
  
      public TestUnmodifiableIntIterator(String testName) {
          super(testName);
      }
      
  
      public static Test suite() {
          return new TestSuite(TestUnmodifiableIntIterator.class);
      }
  
      // framework
      // ------------------------------------------------------------------------
  
      protected IntIterator makeUnmodifiableIntIterator() {
          return UnmodifiableIntIterator.wrap(makeIntIterator());
      }
  
      // tests
      // ------------------------------------------------------------------------
  
      public void testWrapNotNull() {
          assertNotNull(UnmodifiableIntIterator.wrap(makeIntIterator()));
      }
  
      public void testWrapNull() {
          assertNull(UnmodifiableIntIterator.wrap(null));
      }
  
      public void testWrapUnmodifiableIntIterator() {
          IntIterator iter = makeUnmodifiableIntIterator();
          assertSame(iter,UnmodifiableIntIterator.wrap(iter));
      }
  
  }
  
  
  1.1                  jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/decorators/BaseUnmodifiableIntIteratorTest.java
  
  Index: BaseUnmodifiableIntIteratorTest.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/decorators/BaseUnmodifiableIntIteratorTest.java,v 1.1 2003/05/20 17:05:28 rwaldhoff Exp $
   * ====================================================================
   * 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments 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 Software Foundation.
   *
   * 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.decorators;
  
  import junit.framework.TestCase;
  
  import org.apache.commons.collections.primitives.ArrayIntList;
  import org.apache.commons.collections.primitives.IntIterator;
  import org.apache.commons.collections.primitives.IntList;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/05/20 17:05:28 $
   * @author Rodney Waldhoff
   */
  public abstract class BaseUnmodifiableIntIteratorTest extends TestCase {
  
      // conventional
      // ------------------------------------------------------------------------
  
      public BaseUnmodifiableIntIteratorTest(String testName) {
          super(testName);
      }
      
  
      // framework
      // ------------------------------------------------------------------------
      protected abstract IntIterator makeUnmodifiableIntIterator();
  
      protected IntIterator makeIntIterator() {
          IntList list = new ArrayIntList();
          for(int i=0;i<10;i++) {
              list.add(i);
          }
          return list.iterator();
      }
  
      // tests
      // ------------------------------------------------------------------------
  
      public final void testIntIteratorNotModifiable() {
          IntIterator iter = makeUnmodifiableIntIterator();
          assertTrue(iter.hasNext());
          iter.next();
          try {
              iter.remove();
              fail("Expected UnsupportedOperationException");
          } catch(UnsupportedOperationException e) {
              // expected
          }
      }
  
      public final void testIterateIntIterator() {        
          IntIterator iter = makeUnmodifiableIntIterator();
          for(IntIterator expected = makeIntIterator(); expected.hasNext(); ) {
              assertTrue(iter.hasNext());
              assertEquals(expected.next(),iter.next());
          }
          assertTrue(! iter.hasNext() );
      }
  
  }
  
  
  1.1                  jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/decorators/TestUnmodifiableIntListIterator.java
  
  Index: TestUnmodifiableIntListIterator.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/decorators/TestUnmodifiableIntListIterator.java,v 1.1 2003/05/20 17:05:28 rwaldhoff Exp $
   * ====================================================================
   * 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments 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 Software Foundation.
   *
   * 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.decorators;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  import org.apache.commons.collections.primitives.IntListIterator;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/05/20 17:05:28 $
   * @author Rodney Waldhoff
   */
  public class TestUnmodifiableIntListIterator extends BaseUnmodifiableIntListIteratorTest {
  
      // conventional
      // ------------------------------------------------------------------------
  
      public TestUnmodifiableIntListIterator(String testName) {
          super(testName);
      }
      
  
      public static Test suite() {
          return new TestSuite(TestUnmodifiableIntListIterator.class);
      }
  
      // framework
      // ------------------------------------------------------------------------
  
      protected IntListIterator makeUnmodifiableIntListIterator() {
          return UnmodifiableIntListIterator.wrap(makeIntListIterator());
      }
  
      // tests
      // ------------------------------------------------------------------------
  
      public void testWrapNotNull() {
          assertNotNull(UnmodifiableIntListIterator.wrap(makeIntListIterator()));
      }
  
      public void testWrapNull() {
          assertNull(UnmodifiableIntListIterator.wrap(null));
      }
  
      public void testWrapUnmodifiableIntListIterator() {
          IntListIterator iter = makeUnmodifiableIntListIterator();
          assertSame(iter,UnmodifiableIntListIterator.wrap(iter));
      }
  
  }
  
  
  1.1                  jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/decorators/BaseUnmodifiableIntListIteratorTest.java
  
  Index: BaseUnmodifiableIntListIteratorTest.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/decorators/BaseUnmodifiableIntListIteratorTest.java,v 1.1 2003/05/20 17:05:28 rwaldhoff Exp $
   * ====================================================================
   * 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments 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 Software Foundation.
   *
   * 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.decorators;
  
  import org.apache.commons.collections.primitives.ArrayIntList;
  import org.apache.commons.collections.primitives.IntIterator;
  import org.apache.commons.collections.primitives.IntList;
  import org.apache.commons.collections.primitives.IntListIterator;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/05/20 17:05:28 $
   * @author Rodney Waldhoff
   */
  public abstract class BaseUnmodifiableIntListIteratorTest extends BaseUnmodifiableIntIteratorTest {
  
      // conventional
      // ------------------------------------------------------------------------
  
      public BaseUnmodifiableIntListIteratorTest(String testName) {
          super(testName);
      }
      
  
      // framework
      // ------------------------------------------------------------------------
  
      protected abstract IntListIterator makeUnmodifiableIntListIterator();
  
      protected IntIterator makeUnmodifiableIntIterator() {
          return makeUnmodifiableIntListIterator();
      }
  
      protected IntIterator makeIntIterator() {
          return makeIntListIterator();
      }
      
      protected IntListIterator makeIntListIterator() {
          IntList list = new ArrayIntList();
          for(int i=0;i<10;i++) {
              list.add(i);
          }
          return list.listIterator();
      }
  
      // tests
      // ------------------------------------------------------------------------
  
      public final void testIntListIteratorNotModifiable() {
          IntListIterator iter = makeUnmodifiableIntListIterator();
          assertTrue(iter.hasNext());
          iter.next();
          try {
              iter.remove();
              fail("Expected UnsupportedOperationException");
          } catch(UnsupportedOperationException e) {
              // expected
          }
          try {
              iter.add(1);
              fail("Expected UnsupportedOperationException");
          } catch(UnsupportedOperationException e) {
              // expected
          }
          try {
              iter.set(3);
              fail("Expected UnsupportedOperationException");
          } catch(UnsupportedOperationException e) {
              // expected
          }
      }
  
      public final void testIterateIntListIterator() {        
          IntListIterator iter = makeUnmodifiableIntListIterator();
          IntListIterator expected = makeIntListIterator();
          
          assertTrue(! iter.hasPrevious());
          
          while( expected.hasNext() ) {
              assertTrue(iter.hasNext());
              assertEquals(expected.nextIndex(),iter.nextIndex());
              assertEquals(expected.previousIndex(),iter.previousIndex());
              assertEquals(expected.next(),iter.next());
              assertTrue(iter.hasPrevious());
              assertEquals(expected.nextIndex(),iter.nextIndex());
              assertEquals(expected.previousIndex(),iter.previousIndex());
          }
  
          assertTrue(! iter.hasNext() );
  
          while( expected.hasPrevious() ) {
              assertTrue(iter.hasPrevious());
              assertEquals(expected.nextIndex(),iter.nextIndex());
              assertEquals(expected.previousIndex(),iter.previousIndex());
              assertEquals(expected.previous(),iter.previous());
              assertTrue(iter.hasNext());
              assertEquals(expected.nextIndex(),iter.nextIndex());
              assertEquals(expected.previousIndex(),iter.previousIndex());
          }
          assertTrue(! iter.hasPrevious() );
      }
  
  }
  
  
  1.20      +3 -2      jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestAll.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- TestAll.java	4 May 2003 13:06:14 -0000	1.19
  +++ TestAll.java	20 May 2003 17:05:28 -0000	1.20
  @@ -91,6 +91,7 @@
           suite.addTest(TestRandomAccessCharList.suite());
           suite.addTest(TestArrayCharList.suite());
   
  +        suite.addTest(TestIntCollections.suite());
           suite.addTest(TestAbstractIntCollection.suite());
           suite.addTest(TestRandomAccessIntList.suite());
           suite.addTest(TestArrayIntList.suite());
  
  
  
  1.1                  jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestIntCollections.java
  
  Index: TestIntCollections.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestIntCollections.java,v 1.1 2003/05/20 17:05:28 rwaldhoff Exp $
   * ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002-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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments 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 Software Foundation.
   *
   * 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 junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/05/20 17:05:28 $
   * @author Rodney Waldhoff
   * @deprecated as the tested classes are deprecated also
   */
  public class TestIntCollections extends TestCase {
  
      //------------------------------------------------------------ Conventional
  
      public TestIntCollections(String testName) {
          super(testName);
      }
  
      public static Test suite() {
          return new TestSuite(TestIntCollections.class);
      }
  
      //---------------------------------------------------------------- Tests
  
      public void testUnmodifiableIntListNull() {
          try {
              IntCollections.unmodifiableIntList(null);
              fail("Expected NullPointerException");
          } catch(NullPointerException e) {
              // expected
          }
      }
  
      public void testEmptyIntList() {
          assertSame(IntCollections.EMPTY_INT_LIST,IntCollections.getEmptyIntList());
          assertTrue(IntCollections.EMPTY_INT_LIST.isEmpty());
          try {
              IntCollections.EMPTY_INT_LIST.add(1);
              fail("Expected UnsupportedOperationExcpetion");
          } catch(UnsupportedOperationException e) {
              // expected
          }
      }
  
      public void testUnmodifiableIntIteratorNull() {
          try {
              IntCollections.unmodifiableIntIterator(null);
              fail("Expected NullPointerException");
          } catch(NullPointerException e) {
              // expected
          }
      }
  
      public void testEmptyIntIterator() {
          assertSame(IntCollections.EMPTY_INT_ITERATOR,IntCollections.getEmptyIntIterator());
          assertTrue(! IntCollections.EMPTY_INT_ITERATOR.hasNext());
          try {
              IntCollections.EMPTY_INT_ITERATOR.remove();
              fail("Expected UnsupportedOperationExcpetion");
          } catch(UnsupportedOperationException e) {
              // expected
          }
      }
  
      public void testUnmodifiableIntListIteratorNull() {
          try {
              IntCollections.unmodifiableIntListIterator(null);
              fail("Expected NullPointerException");
          } catch(NullPointerException e) {
              // expected
          }
      }
  
      public void testEmptyIntListIterator() {
          assertSame(IntCollections.EMPTY_INT_LIST_ITERATOR,IntCollections.getEmptyIntListIterator());
          assertTrue(! IntCollections.EMPTY_INT_LIST_ITERATOR.hasNext());
          assertTrue(! IntCollections.EMPTY_INT_LIST_ITERATOR.hasPrevious());
          try {
              IntCollections.EMPTY_INT_LIST_ITERATOR.add(1);
              fail("Expected UnsupportedOperationExcpetion");
          } catch(UnsupportedOperationException e) {
              // expected
          }
      }
  }
  
  
  
  
  1.1                  jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/IntCollections.java
  
  Index: IntCollections.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/IntCollections.java,v 1.1 2003/05/20 17:05:28 rwaldhoff Exp $
   * ====================================================================
   * 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments 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 Software Foundation.
   *
   * 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 org.apache.commons.collections.primitives.decorators.UnmodifiableIntIterator;
  import org.apache.commons.collections.primitives.decorators.UnmodifiableIntList;
  import org.apache.commons.collections.primitives.decorators.UnmodifiableIntListIterator;
  
  /**
   * This class consists exclusively of static methods that operate on or
   * return IntCollections.
   * <p>
   * The methods of this class all throw a NullPointerException is the 
   * provided collections are null.
   * 
   * @version $Revision: 1.1 $ $Date: 2003/05/20 17:05:28 $
   * 
   * @author Rodney Waldhoff 
   */
  public class IntCollections {
  
      /**
       * Returns an unmodifiable version of the given non-null IntList.
       * @param list the non-null IntList to wrap in an unmodifiable decorator
       * @return an unmodifiable version of the given non-null IntList
       * @throws NullPointerException if the given IntList is null
       * @see org.apache.commons.collections.primitives.decorators.UnmodifiableIntList#wrap
       */    
      public static final IntList unmodifiableIntList(IntList list) throws NullPointerException {
          if(null == list) {
              throw new NullPointerException();
          }
          return UnmodifiableIntList.wrap(list);
      }
      
      /**
       * Returns an unmodifiable version of the given non-null IntIterator.
       * @param list the non-null IntIterator to wrap in an unmodifiable decorator
       * @return an unmodifiable version of the given non-null IntIterator
       * @throws NullPointerException if the given IntIterator is null
       * @see org.apache.commons.collections.primitives.decorators.UnmodifiableIntIterator#wrap
       */    
      public static final IntIterator unmodifiableIntIterator(IntIterator iter) {
          if(null == iter) {
              throw new NullPointerException();
          }
          return UnmodifiableIntIterator.wrap(iter);
      }
          
      /**
       * Returns an unmodifiable version of the given non-null IntListIterator.
       * @param list the non-null IntListIterator to wrap in an unmodifiable decorator
       * @return an unmodifiable version of the given non-null IntListIterator
       * @throws NullPointerException if the given IntListIterator is null
       * @see org.apache.commons.collections.primitives.decorators.UnmodifiableIntListIterator#wrap
       */    
      public static final IntListIterator unmodifiableIntListIterator(IntListIterator iter) {
          if(null == iter) {
              throw new NullPointerException();
          }
          return UnmodifiableIntListIterator.wrap(iter);
      }
      
      /**
       * Returns an unmodifiable, empty IntList.
       * @return an unmodifiable, empty IntList.
       * @see #EMPTY_INT_LIST
       */    
      public static final IntList getEmptyIntList() {
          return EMPTY_INT_LIST;
      }
      
      /**
       * Returns an unmodifiable, empty IntIterator
       * @return an unmodifiable, empty IntIterator.
       * @see #EMPTY_INT_ITERATOR
       */    
      public static final IntIterator getEmptyIntIterator() {
          return EMPTY_INT_ITERATOR;
      }
      
      /**
       * Returns an unmodifiable, empty IntListIterator
       * @return an unmodifiable, empty IntListIterator.
       * @see #EMPTY_INT_LIST_ITERATOR
       */    
      public static final IntListIterator getEmptyIntListIterator() {
          return EMPTY_INT_LIST_ITERATOR;
      }    
  
      /**
       * An unmodifiable, empty IntList
       * @see #getEmptyIntList
       */    
      public static final IntList EMPTY_INT_LIST = unmodifiableIntList(new ArrayIntList(0));
  
      /**
       * An unmodifiable, empty IntIterator
       * @see #getEmptyIntIterator
       */    
      public static final IntIterator EMPTY_INT_ITERATOR = unmodifiableIntIterator(EMPTY_INT_LIST.iterator());
  
      /**
       * An unmodifiable, empty IntListIterator
       * @see #getEmptyIntListIterator
       */    
      public static final IntListIterator EMPTY_INT_LIST_ITERATOR = unmodifiableIntListIterator(EMPTY_INT_LIST.listIterator());
  }
  
  
  

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