Move map interfaces to main package
Add AMap interface Add HashedMap implementation git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131380 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e078c03320
commit
3ee53ef957
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/AMap.java,v 1.1 2003/12/01 22:34:55 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 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;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.collections.iterators.MapIterator;
|
||||
|
||||
/**
|
||||
* 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>
|
||||
* AMap 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/01 22:34:55 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
public interface AMap 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>
|
||||
* AMap 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,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/bidimap/Attic/BidiMap.java,v 1.1 2003/11/16 20:35:46 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/BidiMap.java,v 1.8 2003/12/01 22:34:55 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -55,7 +55,7 @@
|
|||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
package org.apache.commons.collections.bidimap;
|
||||
package org.apache.commons.collections;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -74,7 +74,7 @@ import org.apache.commons.collections.iterators.MapIterator;
|
|||
* a key to be looked up from a value with equal performance.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/16 20:35:46 $
|
||||
* @version $Revision: 1.8 $ $Date: 2003/12/01 22:34:55 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/bidimap/Attic/OrderedBidiMap.java,v 1.1 2003/11/16 20:35:46 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/OrderedBidiMap.java,v 1.1 2003/12/01 22:34:55 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -55,9 +55,7 @@
|
|||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
package org.apache.commons.collections.bidimap;
|
||||
|
||||
import org.apache.commons.collections.map.OrderedMap;
|
||||
package org.apache.commons.collections;
|
||||
|
||||
/**
|
||||
* Defines a map that allows bidirectional lookup between key and values
|
||||
|
@ -67,7 +65,7 @@ import org.apache.commons.collections.map.OrderedMap;
|
|||
* a key to be looked up from a value with equal performance.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/16 20:35:46 $
|
||||
* @version $Revision: 1.1 $ $Date: 2003/12/01 22:34:55 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/Attic/OrderedMap.java,v 1.2 2003/11/19 23:57:51 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/OrderedMap.java,v 1.1 2003/12/01 22:34:55 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -55,11 +55,8 @@
|
|||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
package org.apache.commons.collections.map;
|
||||
package org.apache.commons.collections;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.collections.iterators.MapIterator;
|
||||
import org.apache.commons.collections.iterators.OrderedMapIterator;
|
||||
|
||||
/**
|
||||
|
@ -67,20 +64,11 @@ import org.apache.commons.collections.iterators.OrderedMapIterator;
|
|||
* iteration through that order.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/19 23:57:51 $
|
||||
* @version $Revision: 1.1 $ $Date: 2003/12/01 22:34:55 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
public interface OrderedMap extends Map {
|
||||
|
||||
/**
|
||||
* Obtains a <code>MapIterator</code> over the map.
|
||||
* <p>
|
||||
* A map iterator is an efficient way of iterating over maps.
|
||||
*
|
||||
* @return a map iterator
|
||||
*/
|
||||
MapIterator mapIterator();
|
||||
public interface OrderedMap extends AMap {
|
||||
|
||||
/**
|
||||
* Obtains an <code>OrderedMapIterator</code> over the map.
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/bidimap/Attic/SortedBidiMap.java,v 1.1 2003/11/16 20:35:46 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/SortedBidiMap.java,v 1.3 2003/12/01 22:34:55 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -55,7 +55,7 @@
|
|||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
package org.apache.commons.collections.bidimap;
|
||||
package org.apache.commons.collections;
|
||||
|
||||
import java.util.SortedMap;
|
||||
|
||||
|
@ -67,7 +67,7 @@ import java.util.SortedMap;
|
|||
* a key to be looked up from a value with equal performance.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/16 20:35:46 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/12/01 22:34:55 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/bidimap/AbstractDualBidiMap.java,v 1.1 2003/11/16 20:35:46 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/bidimap/AbstractDualBidiMap.java,v 1.2 2003/12/01 22:34:54 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -62,6 +62,7 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.BidiMap;
|
||||
import org.apache.commons.collections.collection.AbstractCollectionDecorator;
|
||||
import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
|
||||
import org.apache.commons.collections.iterators.MapIterator;
|
||||
|
@ -75,7 +76,7 @@ import org.apache.commons.collections.pairs.AbstractMapEntryDecorator;
|
|||
* <code>createMap</code> method.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Id: AbstractDualBidiMap.java,v 1.1 2003/11/16 20:35:46 scolebourne Exp $
|
||||
* @version $Id: AbstractDualBidiMap.java,v 1.2 2003/12/01 22:34:54 scolebourne Exp $
|
||||
*
|
||||
* @author Matthew Hawthorne
|
||||
* @author Stephen Colebourne
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/bidimap/DualHashBidiMap.java,v 1.1 2003/11/16 20:35:46 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/bidimap/DualHashBidiMap.java,v 1.2 2003/12/01 22:34:54 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -64,11 +64,13 @@ import java.io.Serializable;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.collections.BidiMap;
|
||||
|
||||
/**
|
||||
* Implementation of <code>BidiMap</code> that uses two <code>HashMap</code> instances.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Id: DualHashBidiMap.java,v 1.1 2003/11/16 20:35:46 scolebourne Exp $
|
||||
* @version $Id: DualHashBidiMap.java,v 1.2 2003/12/01 22:34:54 scolebourne Exp $
|
||||
*
|
||||
* @author Matthew Hawthorne
|
||||
* @author Stephen Colebourne
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java,v 1.3 2003/11/20 00:31:42 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/bidimap/DualTreeBidiMap.java,v 1.4 2003/12/01 22:34:54 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -69,10 +69,13 @@ import java.util.Map;
|
|||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.commons.collections.BidiMap;
|
||||
import org.apache.commons.collections.OrderedBidiMap;
|
||||
import org.apache.commons.collections.OrderedMap;
|
||||
import org.apache.commons.collections.SortedBidiMap;
|
||||
import org.apache.commons.collections.iterators.OrderedMapIterator;
|
||||
import org.apache.commons.collections.iterators.ResettableIterator;
|
||||
import org.apache.commons.collections.map.AbstractSortedMapDecorator;
|
||||
import org.apache.commons.collections.map.OrderedMap;
|
||||
|
||||
/**
|
||||
* Implementation of <code>BidiMap</code> that uses two <code>TreeMap</code> instances.
|
||||
|
@ -85,7 +88,7 @@ import org.apache.commons.collections.map.OrderedMap;
|
|||
* not store each object twice, which can save on memory use.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Id: DualTreeBidiMap.java,v 1.3 2003/11/20 00:31:42 scolebourne Exp $
|
||||
* @version $Id: DualTreeBidiMap.java,v 1.4 2003/12/01 22:34:54 scolebourne Exp $
|
||||
*
|
||||
* @author Matthew Hawthorne
|
||||
* @author Stephen Colebourne
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java,v 1.2 2003/11/20 00:31:42 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java,v 1.3 2003/12/01 22:34:54 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -65,7 +65,9 @@ import java.util.Map;
|
|||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.BidiMap;
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import org.apache.commons.collections.OrderedBidiMap;
|
||||
import org.apache.commons.collections.iterators.MapIterator;
|
||||
import org.apache.commons.collections.iterators.OrderedIterator;
|
||||
import org.apache.commons.collections.iterators.OrderedMapIterator;
|
||||
|
@ -105,7 +107,7 @@ import org.apache.commons.collections.pairs.UnmodifiableMapEntry;
|
|||
* UnsupportedOperationException on attempts to call that method.
|
||||
*
|
||||
* @since Commons Collections 3.0 (previously DoubleOrderedMap v2.0)
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/20 00:31:42 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/12/01 22:34:54 $
|
||||
*
|
||||
* @author Marc Johnson
|
||||
* @author Stephen Colebourne
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java,v 1.1 2003/11/20 22:33:54 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/AbstractOrderedMapDecorator.java,v 1.2 2003/12/01 22:34:53 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -57,6 +57,7 @@
|
|||
*/
|
||||
package org.apache.commons.collections.map;
|
||||
|
||||
import org.apache.commons.collections.OrderedMap;
|
||||
import org.apache.commons.collections.iterators.MapIterator;
|
||||
import org.apache.commons.collections.iterators.OrderedMapIterator;
|
||||
|
||||
|
@ -73,7 +74,7 @@ import org.apache.commons.collections.iterators.OrderedMapIterator;
|
|||
* But, you might want that loophole, so this class is kept simple.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/20 22:33:54 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/12/01 22:34:53 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/Flat3Map.java,v 1.2 2003/11/18 23:34:47 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/Flat3Map.java,v 1.3 2003/12/01 22:34:53 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -66,6 +66,7 @@ import java.util.Map;
|
|||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.AMap;
|
||||
import org.apache.commons.collections.IteratorUtils;
|
||||
import org.apache.commons.collections.iterators.EntrySetMapIterator;
|
||||
import org.apache.commons.collections.iterators.MapIterator;
|
||||
|
@ -99,11 +100,11 @@ import org.apache.commons.collections.iterators.ResettableIterator;
|
|||
* Do not use <code>Flat3Map</code> if the size is likely to grow beyond 3.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/18 23:34:47 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/12/01 22:34:53 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
public class Flat3Map implements Map {
|
||||
public class Flat3Map implements AMap {
|
||||
|
||||
/** The size of the map, used while in flat mode */
|
||||
private int iSize;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/ListOrderedMap.java,v 1.3 2003/11/20 21:46:41 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/ListOrderedMap.java,v 1.4 2003/12/01 22:34:53 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -68,6 +68,7 @@ import java.util.Map;
|
|||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.OrderedMap;
|
||||
import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
|
||||
import org.apache.commons.collections.iterators.MapIterator;
|
||||
import org.apache.commons.collections.iterators.OrderedMapIterator;
|
||||
|
@ -86,7 +87,7 @@ import org.apache.commons.collections.pairs.AbstractMapEntry;
|
|||
* original position in the iteration.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/20 21:46:41 $
|
||||
* @version $Revision: 1.4 $ $Date: 2003/12/01 22:34:53 $
|
||||
*
|
||||
* @author Henri Yandell
|
||||
* @author Stephen Colebourne
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/UnmodifiableMap.java,v 1.2 2003/11/20 22:35:50 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/UnmodifiableMap.java,v 1.3 2003/12/01 22:34:53 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -63,9 +63,13 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.AMap;
|
||||
import org.apache.commons.collections.Unmodifiable;
|
||||
import org.apache.commons.collections.collection.UnmodifiableCollection;
|
||||
import org.apache.commons.collections.iterators.AbstractIteratorDecorator;
|
||||
import org.apache.commons.collections.iterators.EntrySetMapIterator;
|
||||
import org.apache.commons.collections.iterators.MapIterator;
|
||||
import org.apache.commons.collections.iterators.UnmodifiableMapIterator;
|
||||
import org.apache.commons.collections.pairs.AbstractMapEntryDecorator;
|
||||
import org.apache.commons.collections.set.UnmodifiableSet;
|
||||
|
||||
|
@ -73,11 +77,11 @@ import org.apache.commons.collections.set.UnmodifiableSet;
|
|||
* Decorates another <code>Map</code> to ensure it can't be altered.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/20 22:35:50 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/12/01 22:34:53 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
public final class UnmodifiableMap extends AbstractMapDecorator implements Unmodifiable {
|
||||
public final class UnmodifiableMap extends AbstractMapDecorator implements AMap, Unmodifiable {
|
||||
|
||||
/**
|
||||
* Factory method to create an unmodifiable map.
|
||||
|
@ -120,6 +124,16 @@ public final class UnmodifiableMap extends AbstractMapDecorator implements Unmod
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public MapIterator mapIterator() {
|
||||
if (map instanceof AMap) {
|
||||
MapIterator it = ((AMap) map).mapIterator();
|
||||
return UnmodifiableMapIterator.decorate(it);
|
||||
} else {
|
||||
MapIterator it = new EntrySetMapIterator(map);
|
||||
return UnmodifiableMapIterator.decorate(it);
|
||||
}
|
||||
}
|
||||
|
||||
public Set entrySet() {
|
||||
Set set = super.entrySet();
|
||||
return new UnmodifiableEntrySet(set);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java,v 1.1 2003/11/20 22:35:50 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java,v 1.2 2003/12/01 22:34:53 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -61,6 +61,7 @@ import java.util.Collection;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.OrderedMap;
|
||||
import org.apache.commons.collections.Unmodifiable;
|
||||
import org.apache.commons.collections.collection.UnmodifiableCollection;
|
||||
import org.apache.commons.collections.iterators.MapIterator;
|
||||
|
@ -74,7 +75,7 @@ import org.apache.commons.collections.set.UnmodifiableSet;
|
|||
* Decorates another <code>OrderedMap</code> to ensure it can't be altered.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/20 22:35:50 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/12/01 22:34:53 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.java,v 1.3 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/AbstractTestBidiMap.java,v 1.4 2003/12/01 22:34:54 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -63,6 +63,7 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.BidiMap;
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
import org.apache.commons.collections.iterators.AbstractTestMapIterator;
|
||||
import org.apache.commons.collections.iterators.MapIterator;
|
||||
|
@ -71,7 +72,7 @@ import org.apache.commons.collections.map.AbstractTestMap;
|
|||
/**
|
||||
* Abstract test class for {@link BidiMap} methods and contracts.
|
||||
*
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/18 22:37:16 $
|
||||
* @version $Revision: 1.4 $ $Date: 2003/12/01 22:34:54 $
|
||||
*
|
||||
* @author Matthew Hawthorne
|
||||
* @author Stephen Colebourne
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/AbstractTestOrderedBidiMap.java,v 1.2 2003/11/20 00:31:42 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/AbstractTestOrderedBidiMap.java,v 1.3 2003/12/01 22:34:54 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -65,13 +65,14 @@ import java.util.Map;
|
|||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
import org.apache.commons.collections.OrderedBidiMap;
|
||||
import org.apache.commons.collections.iterators.AbstractTestMapIterator;
|
||||
import org.apache.commons.collections.iterators.MapIterator;
|
||||
|
||||
/**
|
||||
* Abstract test class for {@link OrderedBidiMap} methods and contracts.
|
||||
*
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/20 00:31:42 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/12/01 22:34:54 $
|
||||
*
|
||||
* @author Matthew Hawthorne
|
||||
* @author Stephen Colebourne
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java,v 1.4 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/AbstractTestSortedBidiMap.java,v 1.5 2003/12/01 22:34:54 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -70,12 +70,13 @@ import java.util.TreeMap;
|
|||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
import org.apache.commons.collections.SortedBidiMap;
|
||||
import org.apache.commons.collections.map.AbstractTestSortedMap;
|
||||
|
||||
/**
|
||||
* Abstract test class for {@link SortedBidiMap} methods and contracts.
|
||||
*
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/18 22:37:16 $
|
||||
* @version $Revision: 1.5 $ $Date: 2003/12/01 22:34:54 $
|
||||
*
|
||||
* @author Matthew Hawthorne
|
||||
* @author Stephen Colebourne
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/TestDualHashBidiMap.java,v 1.2 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/TestDualHashBidiMap.java,v 1.3 2003/12/01 22:34:54 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -60,12 +60,13 @@ package org.apache.commons.collections.bidimap;
|
|||
import junit.framework.Test;
|
||||
import junit.textui.TestRunner;
|
||||
|
||||
import org.apache.commons.collections.BidiMap;
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
|
||||
/**
|
||||
* JUnit tests.
|
||||
*
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/18 22:37:16 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/12/01 22:34:54 $
|
||||
*
|
||||
* @author Matthew Hawthorne
|
||||
* @author Stephen Colebourne
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap.java,v 1.2 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap.java,v 1.3 2003/12/01 22:34:54 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -60,12 +60,13 @@ package org.apache.commons.collections.bidimap;
|
|||
import junit.framework.Test;
|
||||
import junit.textui.TestRunner;
|
||||
|
||||
import org.apache.commons.collections.BidiMap;
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
|
||||
/**
|
||||
* JUnit tests.
|
||||
*
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/18 22:37:16 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/12/01 22:34:54 $
|
||||
*
|
||||
* @author Matthew Hawthorne
|
||||
* @author Stephen Colebourne
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/TestTreeBidiMap.java,v 1.2 2003/11/18 22:37:16 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/bidimap/TestTreeBidiMap.java,v 1.3 2003/12/01 22:34:54 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -63,12 +63,13 @@ import java.util.TreeMap;
|
|||
import junit.framework.Test;
|
||||
import junit.textui.TestRunner;
|
||||
|
||||
import org.apache.commons.collections.BidiMap;
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
|
||||
/**
|
||||
* JUnit tests.
|
||||
*
|
||||
* @version $Revision: 1.2 $ $Date: 2003/11/18 22:37:16 $
|
||||
* @version $Revision: 1.3 $ $Date: 2003/12/01 22:34:54 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestUnmodifiableMapIterator.java,v 1.4 2003/11/18 22:37:13 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestUnmodifiableMapIterator.java,v 1.5 2003/12/01 22:34:55 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -63,14 +63,14 @@ import java.util.Map;
|
|||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.BidiMap;
|
||||
import org.apache.commons.collections.Unmodifiable;
|
||||
import org.apache.commons.collections.bidimap.BidiMap;
|
||||
import org.apache.commons.collections.bidimap.DualHashBidiMap;
|
||||
|
||||
/**
|
||||
* Tests the UnmodifiableMapIterator.
|
||||
*
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/18 22:37:13 $
|
||||
* @version $Revision: 1.5 $ $Date: 2003/12/01 22:34:55 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestUnmodifiableOrderedMapIterator.java,v 1.1 2003/11/20 21:45:35 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestUnmodifiableOrderedMapIterator.java,v 1.2 2003/12/01 22:34:55 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -64,14 +64,14 @@ import java.util.TreeMap;
|
|||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.OrderedMap;
|
||||
import org.apache.commons.collections.Unmodifiable;
|
||||
import org.apache.commons.collections.map.ListOrderedMap;
|
||||
import org.apache.commons.collections.map.OrderedMap;
|
||||
|
||||
/**
|
||||
* Tests the UnmodifiableOrderedMapIterator.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/20 21:45:35 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/12/01 22:34:55 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,205 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/Attic/AbstractTestAMap.java,v 1.1 2003/12/01 22:34:54 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 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.map;
|
||||
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.collections.AMap;
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
import org.apache.commons.collections.iterators.AbstractTestMapIterator;
|
||||
import org.apache.commons.collections.iterators.MapIterator;
|
||||
|
||||
/**
|
||||
* Abstract test class for {@link AMap} methods and contracts.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2003/12/01 22:34:54 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
public abstract class AbstractTestAMap extends AbstractTestMap {
|
||||
|
||||
/**
|
||||
* JUnit constructor.
|
||||
*
|
||||
* @param testName the test name
|
||||
*/
|
||||
public AbstractTestAMap(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 AbstractTestAMap.this.getNewSampleValues();
|
||||
}
|
||||
|
||||
public boolean supportsRemove() {
|
||||
return AbstractTestAMap.this.isRemoveSupported();
|
||||
}
|
||||
|
||||
public boolean supportsSetValue() {
|
||||
return AbstractTestAMap.this.isSetValueSupported();
|
||||
}
|
||||
|
||||
public MapIterator makeEmptyMapIterator() {
|
||||
resetEmpty();
|
||||
return ((AMap) AbstractTestAMap.this.map).mapIterator();
|
||||
}
|
||||
|
||||
public MapIterator makeFullMapIterator() {
|
||||
resetFull();
|
||||
return ((AMap) AbstractTestAMap.this.map).mapIterator();
|
||||
}
|
||||
|
||||
public Map getMap() {
|
||||
// assumes makeFullMapIterator() called first
|
||||
return AbstractTestAMap.this.map;
|
||||
}
|
||||
|
||||
public Map getConfirmedMap() {
|
||||
// assumes makeFullMapIterator() called first
|
||||
return AbstractTestAMap.this.confirmed;
|
||||
}
|
||||
|
||||
public void verify() {
|
||||
super.verify();
|
||||
AbstractTestAMap.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,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/AbstractTestOrderedMap.java,v 1.1 2003/11/20 22:34:49 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/AbstractTestOrderedMap.java,v 1.2 2003/12/01 22:34:54 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -67,19 +67,19 @@ import java.util.NoSuchElementException;
|
|||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
import org.apache.commons.collections.OrderedMap;
|
||||
import org.apache.commons.collections.comparators.NullComparator;
|
||||
import org.apache.commons.collections.iterators.AbstractTestMapIterator;
|
||||
import org.apache.commons.collections.iterators.AbstractTestOrderedMapIterator;
|
||||
import org.apache.commons.collections.iterators.MapIterator;
|
||||
|
||||
/**
|
||||
* Abstract test class for {@link OrderedMap} methods and contracts.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/20 22:34:49 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/12/01 22:34:54 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
public abstract class AbstractTestOrderedMap extends AbstractTestMap {
|
||||
public abstract class AbstractTestOrderedMap extends AbstractTestAMap {
|
||||
|
||||
/**
|
||||
* JUnit constructor.
|
||||
|
@ -213,57 +213,11 @@ public abstract class AbstractTestOrderedMap extends AbstractTestMap {
|
|||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public BulkTest bulkTestMapIterator() {
|
||||
return new InnerTestOrderedMapIterator();
|
||||
}
|
||||
|
||||
// TODO: Test mapIterator() and orderedMapIterator() separately
|
||||
public class InnerTestMapIterator extends AbstractTestMapIterator {
|
||||
public InnerTestMapIterator() {
|
||||
super("InnerTestMapIterator");
|
||||
}
|
||||
|
||||
public boolean supportsRemove() {
|
||||
return AbstractTestOrderedMap.this.isRemoveSupported();
|
||||
}
|
||||
|
||||
public boolean supportsSetValue() {
|
||||
return AbstractTestOrderedMap.this.isSetValueSupported();
|
||||
}
|
||||
|
||||
public MapIterator makeEmptyMapIterator() {
|
||||
resetEmpty();
|
||||
return ((OrderedMap) AbstractTestOrderedMap.this.map).mapIterator();
|
||||
}
|
||||
|
||||
public MapIterator makeFullMapIterator() {
|
||||
resetFull();
|
||||
return ((OrderedMap) AbstractTestOrderedMap.this.map).mapIterator();
|
||||
}
|
||||
|
||||
public Map getMap() {
|
||||
// assumes makeFullMapIterator() called first
|
||||
return AbstractTestOrderedMap.this.map;
|
||||
}
|
||||
|
||||
public Map getConfirmedMap() {
|
||||
// assumes makeFullMapIterator() called first
|
||||
return AbstractTestOrderedMap.this.confirmed;
|
||||
}
|
||||
|
||||
public void verify() {
|
||||
super.verify();
|
||||
AbstractTestOrderedMap.this.verify();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public BulkTest bulkTestOrderedMapIterator() {
|
||||
return new InnerTestOrderedMapIterator();
|
||||
}
|
||||
|
||||
// TODO: Test mapIterator() and orderedMapIterator() separately
|
||||
public class InnerTestOrderedMapIterator extends AbstractTestOrderedMapIterator {
|
||||
public InnerTestOrderedMapIterator() {
|
||||
super("InnerTestOrderedMapIterator");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestAll.java,v 1.3 2003/11/20 22:35:50 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestAll.java,v 1.4 2003/12/01 22:34:54 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -65,7 +65,7 @@ import junit.framework.TestSuite;
|
|||
* Entry point for tests.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.3 $ $Date: 2003/11/20 22:35:50 $
|
||||
* @version $Revision: 1.4 $ $Date: 2003/12/01 22:34:54 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
@ -86,6 +86,7 @@ public class TestAll extends TestCase {
|
|||
suite.addTest(TestFixedSizeMap.suite());
|
||||
suite.addTest(TestFixedSizeSortedMap.suite());
|
||||
suite.addTest(TestFlat3Map.suite());
|
||||
suite.addTest(TestHashedMap.suite());
|
||||
suite.addTest(TestLazyMap.suite());
|
||||
suite.addTest(TestLazySortedMap.suite());
|
||||
suite.addTest(TestListOrderedMap.suite());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestFlat3Map.java,v 1.1 2003/11/18 23:23:05 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestFlat3Map.java,v 1.2 2003/12/01 22:34:54 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -69,11 +69,11 @@ import org.apache.commons.collections.iterators.MapIterator;
|
|||
/**
|
||||
* JUnit tests.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/18 23:23:05 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/12/01 22:34:54 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
public class TestFlat3Map extends AbstractTestMap {
|
||||
public class TestFlat3Map extends AbstractTestAMap {
|
||||
|
||||
public TestFlat3Map(String testName) {
|
||||
super(testName);
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestHashedMap.java,v 1.1 2003/12/01 22:34:54 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 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.map;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.textui.TestRunner;
|
||||
|
||||
import org.apache.commons.collections.BulkTest;
|
||||
|
||||
/**
|
||||
* JUnit tests.
|
||||
*
|
||||
* @version $Revision: 1.1 $ $Date: 2003/12/01 22:34:54 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
public class TestHashedMap extends AbstractTestAMap {
|
||||
|
||||
public TestHashedMap(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
TestRunner.run(suite());
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
return BulkTest.makeSuite(TestHashedMap.class);
|
||||
}
|
||||
|
||||
public Map makeEmptyMap() {
|
||||
return new HashedMap();
|
||||
}
|
||||
|
||||
public String getCompatibilityVersion() {
|
||||
return "3";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestUnmodifiableMap.java,v 1.4 2003/11/20 22:35:50 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestUnmodifiableMap.java,v 1.5 2003/12/01 22:34:54 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -70,11 +70,11 @@ import org.apache.commons.collections.Unmodifiable;
|
|||
* {@link UnmodifiableMap} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.4 $ $Date: 2003/11/20 22:35:50 $
|
||||
* @version $Revision: 1.5 $ $Date: 2003/12/01 22:34:54 $
|
||||
*
|
||||
* @author Phil Steitz
|
||||
*/
|
||||
public class TestUnmodifiableMap extends AbstractTestMap{
|
||||
public class TestUnmodifiableMap extends AbstractTestAMap{
|
||||
|
||||
public TestUnmodifiableMap(String testName) {
|
||||
super(testName);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestUnmodifiableOrderedMap.java,v 1.1 2003/11/20 22:35:50 scolebourne Exp $
|
||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/map/TestUnmodifiableOrderedMap.java,v 1.2 2003/12/01 22:34:54 scolebourne Exp $
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
|
@ -63,6 +63,7 @@ import java.util.Map;
|
|||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.commons.collections.OrderedMap;
|
||||
import org.apache.commons.collections.Unmodifiable;
|
||||
|
||||
/**
|
||||
|
@ -70,7 +71,7 @@ import org.apache.commons.collections.Unmodifiable;
|
|||
* {@link UnmodifiableOrderedMap} implementation.
|
||||
*
|
||||
* @since Commons Collections 3.0
|
||||
* @version $Revision: 1.1 $ $Date: 2003/11/20 22:35:50 $
|
||||
* @version $Revision: 1.2 $ $Date: 2003/12/01 22:34:54 $
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue