Ensure all MapEntry implementation are also KeyValue implementations

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131413 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-12-06 13:03:15 +00:00
parent 5457ede14f
commit 5f8fc2f974
10 changed files with 39 additions and 33 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/DefaultMapEntry.java,v 1.15 2003/12/05 20:23:57 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/DefaultMapEntry.java,v 1.16 2003/12/06 13:03:15 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -62,17 +62,16 @@ import java.util.Map;
/** /**
* A default implementation of {@link java.util.Map.Entry} * A default implementation of {@link java.util.Map.Entry}
* *
* @deprecated Use the version in the keyvalue subpackage.
* @since Commons Collections 1.0 * @since Commons Collections 1.0
* @version $Revision: 1.15 $ $Date: 2003/12/05 20:23:57 $ * @version $Revision: 1.16 $ $Date: 2003/12/06 13:03:15 $
* *
* @author James Strachan * @author James Strachan
* @author Michael A. Smith * @author Michael A. Smith
* @author Neil O'Toole * @author Neil O'Toole
* @author Stephen Colebourne * @author Stephen Colebourne
*
* @deprecated Use the version in the keyvalue subpackage.
*/ */
public class DefaultMapEntry implements Map.Entry { public class DefaultMapEntry implements Map.Entry, KeyValue {
/** The key */ /** The key */
private Object key; private Object key;

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/DoubleOrderedMap.java,v 1.8 2003/11/29 18:05:39 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/DoubleOrderedMap.java,v 1.9 2003/12/06 13:03:15 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -141,7 +141,7 @@ import java.util.Set;
* @see DualTreeBidiMap * @see DualTreeBidiMap
* @see DualHashBidiMap * @see DualHashBidiMap
* @since Commons Collections 2.0 * @since Commons Collections 2.0
* @version $Revision: 1.8 $ $Date: 2003/11/29 18:05:39 $ * @version $Revision: 1.9 $ $Date: 2003/12/06 13:03:15 $
* *
* @author Marc Johnson * @author Marc Johnson
*/ */
@ -1794,7 +1794,7 @@ public final class DoubleOrderedMap extends AbstractMap {
} // end private abstract class DoubleOrderedMapIterator } // end private abstract class DoubleOrderedMapIterator
// final for performance // final for performance
private static final class Node implements Map.Entry { private static final class Node implements Map.Entry, KeyValue {
private Comparable[] data; private Comparable[] data;
private Node[] leftNode; private Node[] leftNode;

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/ReferenceMap.java,v 1.18 2003/12/05 20:23:57 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/ReferenceMap.java,v 1.19 2003/12/06 13:03:15 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -119,7 +119,7 @@ import org.apache.commons.collections.keyvalue.DefaultMapEntry;
* *
* @deprecated Moved to map subpackage. Due to be removed in v4.0. * @deprecated Moved to map subpackage. Due to be removed in v4.0.
* @since Commons Collections 2.1 * @since Commons Collections 2.1
* @version $Revision: 1.18 $ $Date: 2003/12/05 20:23:57 $ * @version $Revision: 1.19 $ $Date: 2003/12/06 13:03:15 $
* *
* @author Paul Jack * @author Paul Jack
*/ */
@ -758,7 +758,7 @@ public class ReferenceMap extends AbstractMap {
// If getKey() or getValue() returns null, it means // If getKey() or getValue() returns null, it means
// the mapping is stale and should be removed. // the mapping is stale and should be removed.
private class Entry implements Map.Entry { private class Entry implements Map.Entry, KeyValue {
Object key; Object key;
Object value; Object value;

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/SequencedHashMap.java,v 1.22 2003/12/03 11:37:44 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/SequencedHashMap.java,v 1.23 2003/12/06 13:03:15 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -91,7 +91,7 @@ import org.apache.commons.collections.list.UnmodifiableList;
* *
* @see org.apache.commons.collections.set.ListOrderedSet * @see org.apache.commons.collections.set.ListOrderedSet
* @since Commons Collections 2.0 * @since Commons Collections 2.0
* @version $Revision: 1.22 $ $Date: 2003/12/03 11:37:44 $ * @version $Revision: 1.23 $ $Date: 2003/12/06 13:03:15 $
* *
* @author Michael A. Smith * @author Michael A. Smith
* @author Daniel Rall * @author Daniel Rall
@ -104,7 +104,7 @@ public class SequencedHashMap implements Map, Cloneable, Externalizable {
* {@link java.util.Map.Entry} that doubles as a node in the linked list * {@link java.util.Map.Entry} that doubles as a node in the linked list
* of sequenced mappings. * of sequenced mappings.
*/ */
private static class Entry implements Map.Entry { private static class Entry implements Map.Entry, KeyValue {
// Note: This class cannot easily be made clonable. While the actual // Note: This class cannot easily be made clonable. While the actual
// implementation of a clone would be simple, defining the semantics is // implementation of a clone would be simple, defining the semantics is
// difficult. If a shallow clone is implemented, then entry.next.prev != // difficult. If a shallow clone is implemented, then entry.next.prev !=

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/StaticBucketMap.java,v 1.13 2003/12/03 15:16:49 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/StaticBucketMap.java,v 1.14 2003/12/06 13:03:15 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -131,7 +131,7 @@ import java.util.Set;
* *
* @deprecated Moved to map subpackage. Due to be removed in v4.0. * @deprecated Moved to map subpackage. Due to be removed in v4.0.
* @since Commons Collections 2.1 * @since Commons Collections 2.1
* @version $Revision: 1.13 $ $Date: 2003/12/03 15:16:49 $ * @version $Revision: 1.14 $ $Date: 2003/12/06 13:03:15 $
* *
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a> * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
* @author <a href="mailto:g-froehlich@gmx.de">Gerhard Froehlich</a> * @author <a href="mailto:g-froehlich@gmx.de">Gerhard Froehlich</a>
@ -491,7 +491,7 @@ public final class StaticBucketMap implements Map {
/** /**
* The Map.Entry for the StaticBucketMap. * The Map.Entry for the StaticBucketMap.
*/ */
private static final class Node implements Map.Entry private static final class Node implements Map.Entry, KeyValue
{ {
protected Object key; protected Object key;
protected Object value; protected Object value;

View File

@ -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.5 2003/12/05 20:23:58 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.6 2003/12/06 13:03:15 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -67,6 +67,7 @@ import java.util.Set;
import org.apache.commons.collections.BidiMap; import org.apache.commons.collections.BidiMap;
import org.apache.commons.collections.IteratorUtils; import org.apache.commons.collections.IteratorUtils;
import org.apache.commons.collections.KeyValue;
import org.apache.commons.collections.MapIterator; import org.apache.commons.collections.MapIterator;
import org.apache.commons.collections.OrderedBidiMap; import org.apache.commons.collections.OrderedBidiMap;
import org.apache.commons.collections.OrderedIterator; import org.apache.commons.collections.OrderedIterator;
@ -107,7 +108,7 @@ import org.apache.commons.collections.keyvalue.UnmodifiableMapEntry;
* UnsupportedOperationException on attempts to call that method. * UnsupportedOperationException on attempts to call that method.
* *
* @since Commons Collections 3.0 (previously DoubleOrderedMap v2.0) * @since Commons Collections 3.0 (previously DoubleOrderedMap v2.0)
* @version $Revision: 1.5 $ $Date: 2003/12/05 20:23:58 $ * @version $Revision: 1.6 $ $Date: 2003/12/06 13:03:15 $
* *
* @author Marc Johnson * @author Marc Johnson
* @author Stephen Colebourne * @author Stephen Colebourne
@ -1713,7 +1714,7 @@ public class TreeBidiMap implements OrderedBidiMap {
/** /**
* A node used to store the data. * A node used to store the data.
*/ */
static class Node implements Map.Entry { static class Node implements Map.Entry, KeyValue {
private Comparable[] data; private Comparable[] data;
private Node[] leftNode; private Node[] leftNode;

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.java,v 1.1 2003/12/05 20:23:56 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/keyvalue/AbstractMapEntryDecorator.java,v 1.2 2003/12/06 13:03:15 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -59,16 +59,18 @@ package org.apache.commons.collections.keyvalue;
import java.util.Map; import java.util.Map;
import org.apache.commons.collections.KeyValue;
/** /**
* Provides a base decorator that allows additional functionality to be added * Provides a base decorator that allows additional functionality to be added
* to a Map Entry. * to a Map Entry.
* *
* @since Commons Collections 3.0 * @since Commons Collections 3.0
* @version $Revision: 1.1 $ $Date: 2003/12/05 20:23:56 $ * @version $Revision: 1.2 $ $Date: 2003/12/06 13:03:15 $
* *
* @author Stephen Colebourne * @author Stephen Colebourne
*/ */
public abstract class AbstractMapEntryDecorator implements Map.Entry { public abstract class AbstractMapEntryDecorator implements Map.Entry, KeyValue {
/** The <code>Map.Entry</code> to decorate */ /** The <code>Map.Entry</code> to decorate */
protected final Map.Entry entry; protected final Map.Entry entry;
@ -81,7 +83,7 @@ public abstract class AbstractMapEntryDecorator implements Map.Entry {
*/ */
public AbstractMapEntryDecorator(Map.Entry entry) { public AbstractMapEntryDecorator(Map.Entry entry) {
if (entry == null) { if (entry == null) {
throw new IllegalArgumentException("Map entry must not be null"); throw new IllegalArgumentException("Map Entry must not be null");
} }
this.entry = entry; this.entry = entry;
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/HashedMap.java,v 1.5 2003/12/03 19:04:41 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/HashedMap.java,v 1.6 2003/12/06 13:03:15 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -72,6 +72,7 @@ import java.util.Set;
import org.apache.commons.collections.IterableMap; import org.apache.commons.collections.IterableMap;
import org.apache.commons.collections.IteratorUtils; import org.apache.commons.collections.IteratorUtils;
import org.apache.commons.collections.KeyValue;
import org.apache.commons.collections.MapIterator; import org.apache.commons.collections.MapIterator;
/** /**
@ -86,7 +87,7 @@ import org.apache.commons.collections.MapIterator;
* methods exposed. * methods exposed.
* *
* @since Commons Collections 3.0 * @since Commons Collections 3.0
* @version $Revision: 1.5 $ $Date: 2003/12/03 19:04:41 $ * @version $Revision: 1.6 $ $Date: 2003/12/06 13:03:15 $
* *
* @author java util HashMap * @author java util HashMap
* @author Stephen Colebourne * @author Stephen Colebourne
@ -853,7 +854,7 @@ public class HashedMap implements IterableMap, Serializable, Cloneable {
/** /**
* HashEntry * HashEntry
*/ */
protected static class HashEntry implements Map.Entry { protected static class HashEntry implements Map.Entry, KeyValue {
protected HashEntry next; protected HashEntry next;
protected int hashCode; protected int hashCode;
protected Object key; protected Object key;

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/ReferenceMap.java,v 1.2 2003/12/05 20:23:57 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/ReferenceMap.java,v 1.3 2003/12/06 13:03:15 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -76,6 +76,7 @@ import java.util.Map;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import java.util.Set; import java.util.Set;
import org.apache.commons.collections.KeyValue;
import org.apache.commons.collections.keyvalue.DefaultMapEntry; import org.apache.commons.collections.keyvalue.DefaultMapEntry;
/** /**
@ -118,7 +119,7 @@ import org.apache.commons.collections.keyvalue.DefaultMapEntry;
* @see java.lang.ref.Reference * @see java.lang.ref.Reference
* *
* @since Commons Collections 3.0 * @since Commons Collections 3.0
* @version $Revision: 1.2 $ $Date: 2003/12/05 20:23:57 $ * @version $Revision: 1.3 $ $Date: 2003/12/06 13:03:15 $
* *
* @author Paul Jack * @author Paul Jack
*/ */
@ -757,7 +758,7 @@ public class ReferenceMap extends AbstractMap {
// If getKey() or getValue() returns null, it means // If getKey() or getValue() returns null, it means
// the mapping is stale and should be removed. // the mapping is stale and should be removed.
private class Entry implements Map.Entry { private class Entry implements Map.Entry, KeyValue {
Object key; Object key;
Object value; Object value;

View File

@ -1,5 +1,5 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/StaticBucketMap.java,v 1.1 2003/12/03 15:16:49 scolebourne Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/map/StaticBucketMap.java,v 1.2 2003/12/06 13:03:15 scolebourne Exp $
* ==================================================================== * ====================================================================
* *
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
@ -66,6 +66,8 @@ import java.util.Map;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import java.util.Set; import java.util.Set;
import org.apache.commons.collections.KeyValue;
/** /**
* A StaticBucketMap is an efficient, thread-safe implementation of * A StaticBucketMap is an efficient, thread-safe implementation of
* <code>java.util.Map</code> that performs well in in a highly * <code>java.util.Map</code> that performs well in in a highly
@ -130,7 +132,7 @@ import java.util.Set;
* operations will affect the map.<p> * operations will affect the map.<p>
* *
* @since Commons Collections 3.0 * @since Commons Collections 3.0
* @version $Revision: 1.1 $ $Date: 2003/12/03 15:16:49 $ * @version $Revision: 1.2 $ $Date: 2003/12/06 13:03:15 $
* *
* @author Berin Loritsch * @author Berin Loritsch
* @author Gerhard Froehlich * @author Gerhard Froehlich
@ -478,7 +480,7 @@ public final class StaticBucketMap implements Map {
/** /**
* The Map.Entry for the StaticBucketMap. * The Map.Entry for the StaticBucketMap.
*/ */
private static final class Node implements Map.Entry { private static final class Node implements Map.Entry, KeyValue {
protected Object key; protected Object key;
protected Object value; protected Object value;
protected Node next; protected Node next;