scolebourne 2003/12/02 15:51:50 Modified: collections/src/test/org/apache/commons/collections/map TestUnmodifiableMap.java AbstractTestOrderedMap.java TestIdentityMap.java TestHashedMap.java TestFlat3Map.java collections/src/java/org/apache/commons/collections OrderedMap.java MapIterator.java BidiMap.java collections/src/java/org/apache/commons/collections/map HashedMap.java UnmodifiableMap.java Flat3Map.java Added: collections/src/test/org/apache/commons/collections/map AbstractTestIterableMap.java collections/src/java/org/apache/commons/collections IterableMap.java Removed: collections/src/test/org/apache/commons/collections/map AbstractTestAMap.java collections/src/java/org/apache/commons/collections AMap.java Log: Rename AMap to IterableMap Revision Changes Path 1.6 +3 -3 jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestUnmodifiableMap.java Index: TestUnmodifiableMap.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestUnmodifiableMap.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TestUnmodifiableMap.java 1 Dec 2003 22:34:54 -0000 1.5 +++ TestUnmodifiableMap.java 2 Dec 2003 23:51:49 -0000 1.6 @@ -74,7 +74,7 @@ * * @author Phil Steitz */ -public class TestUnmodifiableMap extends AbstractTestAMap{ +public class TestUnmodifiableMap extends AbstractTestIterableMap{ public TestUnmodifiableMap(String testName) { super(testName); 1.4 +3 -3 jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestOrderedMap.java Index: AbstractTestOrderedMap.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestOrderedMap.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- AbstractTestOrderedMap.java 1 Dec 2003 22:48:59 -0000 1.3 +++ AbstractTestOrderedMap.java 2 Dec 2003 23:51:49 -0000 1.4 @@ -79,7 +79,7 @@ * * @author Stephen Colebourne */ -public abstract class AbstractTestOrderedMap extends AbstractTestAMap { +public abstract class AbstractTestOrderedMap extends AbstractTestIterableMap { /** * JUnit constructor. 1.2 +5 -5 jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestIdentityMap.java Index: TestIdentityMap.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestIdentityMap.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestIdentityMap.java 2 Dec 2003 21:57:08 -0000 1.1 +++ TestIdentityMap.java 2 Dec 2003 23:51:49 -0000 1.2 @@ -64,7 +64,7 @@ import junit.framework.TestSuite; import junit.textui.TestRunner; -import org.apache.commons.collections.AMap; +import org.apache.commons.collections.IterableMap; import org.apache.commons.collections.AbstractTestObject; /** @@ -104,7 +104,7 @@ //----------------------------------------------------------------------- public void testBasics() { - AMap map = new IdentityMap(); + IterableMap map = new IdentityMap(); assertEquals(0, map.size()); map.put(I1A, I2A); @@ -137,7 +137,7 @@ //----------------------------------------------------------------------- public void testHashEntry() { - AMap map = new IdentityMap(); + IterableMap map = new IdentityMap(); map.put(I1A, I2A); map.put(I1B, I2A); 1.2 +3 -3 jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestHashedMap.java Index: TestHashedMap.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestHashedMap.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestHashedMap.java 1 Dec 2003 22:34:54 -0000 1.1 +++ TestHashedMap.java 2 Dec 2003 23:51:49 -0000 1.2 @@ -71,7 +71,7 @@ * * @author Stephen Colebourne */ -public class TestHashedMap extends AbstractTestAMap { +public class TestHashedMap extends AbstractTestIterableMap { public TestHashedMap(String testName) { super(testName); 1.4 +3 -3 jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestFlat3Map.java Index: TestFlat3Map.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestFlat3Map.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestFlat3Map.java 1 Dec 2003 22:48:59 -0000 1.3 +++ TestFlat3Map.java 2 Dec 2003 23:51:49 -0000 1.4 @@ -73,7 +73,7 @@ * * @author Stephen Colebourne */ -public class TestFlat3Map extends AbstractTestAMap { +public class TestFlat3Map extends AbstractTestIterableMap { public TestFlat3Map(String testName) { super(testName); 1.1 jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.java Index: AbstractTestIterableMap.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/AbstractTestIterableMap.java,v 1.1 2003/12/02 23:51:49 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2001-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 acknowledgement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgement may appear in the software itself, * if and wherever such third-party acknowledgements 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 [EMAIL PROTECTED] * * 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.map; import java.util.ConcurrentModificationException; import java.util.Iterator; import java.util.Map; import org.apache.commons.collections.IterableMap; import org.apache.commons.collections.BulkTest; import org.apache.commons.collections.MapIterator; import org.apache.commons.collections.iterators.AbstractTestMapIterator; /** * Abstract test class for [EMAIL PROTECTED] IterableMap} methods and contracts. * * @version $Revision: 1.1 $ $Date: 2003/12/02 23:51:49 $ * * @author Stephen Colebourne */ public abstract class AbstractTestIterableMap extends AbstractTestMap { /** * JUnit constructor. * * @param testName the test name */ public AbstractTestIterableMap(String testName) { super(testName); } //----------------------------------------------------------------------- public void testFailFastEntrySet() { if (isRemoveSupported() == false) return; resetFull(); Iterator it = map.entrySet().iterator(); Map.Entry val = (Map.Entry) it.next(); map.remove(val.getKey()); try { it.next(); fail(); } catch (ConcurrentModificationException ex) {} resetFull(); it = map.entrySet().iterator(); it.next(); map.clear(); try { it.next(); fail(); } catch (ConcurrentModificationException ex) {} } public void testFailFastKeySet() { if (isRemoveSupported() == false) return; resetFull(); Iterator it = map.keySet().iterator(); Object val = it.next(); map.remove(val); try { it.next(); fail(); } catch (ConcurrentModificationException ex) {} resetFull(); it = map.keySet().iterator(); it.next(); map.clear(); try { it.next(); fail(); } catch (ConcurrentModificationException ex) {} } public void testFailFastValues() { if (isRemoveSupported() == false) return; resetFull(); Iterator it = map.values().iterator(); it.next(); map.remove(map.keySet().iterator().next()); try { it.next(); fail(); } catch (ConcurrentModificationException ex) {} resetFull(); it = map.values().iterator(); it.next(); map.clear(); try { it.next(); fail(); } catch (ConcurrentModificationException ex) {} } //----------------------------------------------------------------------- public BulkTest bulkTestMapIterator() { return new InnerTestMapIterator(); } public class InnerTestMapIterator extends AbstractTestMapIterator { public InnerTestMapIterator() { super("InnerTestMapIterator"); } public Object[] addSetValues() { return AbstractTestIterableMap.this.getNewSampleValues(); } public boolean supportsRemove() { return AbstractTestIterableMap.this.isRemoveSupported(); } public boolean supportsSetValue() { return AbstractTestIterableMap.this.isSetValueSupported(); } public MapIterator makeEmptyMapIterator() { resetEmpty(); return ((IterableMap) AbstractTestIterableMap.this.map).mapIterator(); } public MapIterator makeFullMapIterator() { resetFull(); return ((IterableMap) AbstractTestIterableMap.this.map).mapIterator(); } public Map getMap() { // assumes makeFullMapIterator() called first return AbstractTestIterableMap.this.map; } public Map getConfirmedMap() { // assumes makeFullMapIterator() called first return AbstractTestIterableMap.this.confirmed; } public void verify() { super.verify(); AbstractTestIterableMap.this.verify(); } } // public void testCreate() throws Exception { // resetEmpty(); // writeExternalFormToDisk((Serializable) map, "D:/dev/collections/data/test/HashedMap.emptyCollection.version3.obj"); // resetFull(); // writeExternalFormToDisk((Serializable) map, "D:/dev/collections/data/test/HashedMap.fullCollection.version3.obj"); // } } 1.3 +3 -3 jakarta-commons/collections/src/java/org/apache/commons/collections/OrderedMap.java Index: OrderedMap.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/OrderedMap.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- OrderedMap.java 1 Dec 2003 22:48:59 -0000 1.2 +++ OrderedMap.java 2 Dec 2003 23:51:49 -0000 1.3 @@ -66,7 +66,7 @@ * * @author Stephen Colebourne */ -public interface OrderedMap extends AMap { +public interface OrderedMap extends IterableMap { /** * Obtains an <code>OrderedMapIterator</code> over the map. 1.4 +4 -4 jakarta-commons/collections/src/java/org/apache/commons/collections/MapIterator.java Index: MapIterator.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/MapIterator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- MapIterator.java 1 Dec 2003 22:48:59 -0000 1.3 +++ MapIterator.java 2 Dec 2003 23:51:49 -0000 1.4 @@ -62,9 +62,9 @@ /** * Defines an iterator that operates over a <code>Map</code>. * <p> - * This iterator is a special version designed for maps. It is much more + * This iterator is a special version designed for maps. It can be more * efficient to use this rather than an entry set iterator where the option - * is available. + * is available, and it is certainly more convenient. * <p> * A map that provides this interface may not hold the data internally using * Map Entry objects, thus this interface can avoid lots of object creation. 1.10 +3 -3 jakarta-commons/collections/src/java/org/apache/commons/collections/BidiMap.java Index: BidiMap.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/BidiMap.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- BidiMap.java 1 Dec 2003 22:48:59 -0000 1.9 +++ BidiMap.java 2 Dec 2003 23:51:49 -0000 1.10 @@ -74,7 +74,7 @@ * * @author Stephen Colebourne */ -public interface BidiMap extends AMap { +public interface BidiMap extends IterableMap { /** * Obtains a <code>MapIterator</code> over the map. 1.1 jakarta-commons/collections/src/java/org/apache/commons/collections/IterableMap.java Index: IterableMap.java =================================================================== /* * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/IterableMap.java,v 1.1 2003/12/02 23:51:49 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 2001-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 acknowledgement: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgement may appear in the software itself, * if and wherever such third-party acknowledgements 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 [EMAIL PROTECTED] * * 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; import java.util.Map; /** * Defines a map that can be iterated directly without needing to create an entry set. * <p> * A map iterator is an efficient way of iterating over maps. * There is no need to access the entry set or cast to Map Entry objects. * <pre> * IterableMap map = new HashedMap(); * MapIterator it = map.mapIterator(); * while (it.hasNext()) { * Object key = it.next(); * Object value = it.getValue(); * it.setValue("newValue"); * } * </pre> * * @since Commons Collections 3.0 * @version $Revision: 1.1 $ $Date: 2003/12/02 23:51:49 $ * * @author Stephen Colebourne */ public interface IterableMap extends Map { /** * Obtains a <code>MapIterator</code> over the map. * <p> * A map iterator is an efficient way of iterating over maps. * There is no need to access the entry set or cast to Map Entry objects. * <pre> * IterableMap map = new HashedMap(); * MapIterator it = map.mapIterator(); * while (it.hasNext()) { * Object key = it.next(); * Object value = it.getValue(); * it.setValue("newValue"); * } * </pre> * * @return a map iterator */ MapIterator mapIterator(); } 1.4 +4 -4 jakarta-commons/collections/src/java/org/apache/commons/collections/map/HashedMap.java Index: HashedMap.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/map/HashedMap.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- HashedMap.java 2 Dec 2003 00:37:11 -0000 1.3 +++ HashedMap.java 2 Dec 2003 23:51:50 -0000 1.4 @@ -70,7 +70,7 @@ import java.util.NoSuchElementException; import java.util.Set; -import org.apache.commons.collections.AMap; +import org.apache.commons.collections.IterableMap; import org.apache.commons.collections.IteratorUtils; import org.apache.commons.collections.MapIterator; @@ -91,7 +91,7 @@ * @author java util HashMap * @author Stephen Colebourne */ -public class HashedMap implements AMap, Serializable, Cloneable { +public class HashedMap implements IterableMap, Serializable, Cloneable { /** Serialisation version */ static final long serialVersionUID = -1593250834999590599L; 1.5 +6 -6 jakarta-commons/collections/src/java/org/apache/commons/collections/map/UnmodifiableMap.java Index: UnmodifiableMap.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/map/UnmodifiableMap.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- UnmodifiableMap.java 1 Dec 2003 22:48:59 -0000 1.4 +++ UnmodifiableMap.java 2 Dec 2003 23:51:50 -0000 1.5 @@ -63,7 +63,7 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.collections.AMap; +import org.apache.commons.collections.IterableMap; import org.apache.commons.collections.MapIterator; import org.apache.commons.collections.Unmodifiable; import org.apache.commons.collections.collection.UnmodifiableCollection; @@ -81,7 +81,7 @@ * * @author Stephen Colebourne */ -public final class UnmodifiableMap extends AbstractMapDecorator implements AMap, Unmodifiable { +public final class UnmodifiableMap extends AbstractMapDecorator implements IterableMap, Unmodifiable { /** * Factory method to create an unmodifiable map. @@ -125,8 +125,8 @@ } public MapIterator mapIterator() { - if (map instanceof AMap) { - MapIterator it = ((AMap) map).mapIterator(); + if (map instanceof IterableMap) { + MapIterator it = ((IterableMap) map).mapIterator(); return UnmodifiableMapIterator.decorate(it); } else { MapIterator it = new EntrySetMapIterator(map); 1.5 +4 -4 jakarta-commons/collections/src/java/org/apache/commons/collections/map/Flat3Map.java Index: Flat3Map.java =================================================================== RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/map/Flat3Map.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Flat3Map.java 1 Dec 2003 22:48:59 -0000 1.4 +++ Flat3Map.java 2 Dec 2003 23:51:50 -0000 1.5 @@ -66,7 +66,7 @@ import java.util.NoSuchElementException; import java.util.Set; -import org.apache.commons.collections.AMap; +import org.apache.commons.collections.IterableMap; import org.apache.commons.collections.IteratorUtils; import org.apache.commons.collections.MapIterator; import org.apache.commons.collections.ResettableIterator; @@ -104,7 +104,7 @@ * * @author Stephen Colebourne */ -public class Flat3Map implements AMap { +public class Flat3Map implements IterableMap { /** The size of the map, used while in flat mode */ private int iSize;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]