commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections/map FixedSizeMap.java
Date Fri, 02 Apr 2004 21:15:05 GMT
scolebourne    2004/04/02 13:15:05

  Modified:    collections RELEASE-NOTES.html
               collections/src/test/org/apache/commons/collections/map
                        TestFixedSizeMap.java
               collections/src/java/org/apache/commons/collections/map
                        FixedSizeMap.java
  Added:       collections/data/test
                        FixedSizeMap.fullCollection.version3.1.obj
                        FixedSizeMap.emptyCollection.version3.1.obj
  Log:
  Make FixedSizeMap Serializable [18815]
  
  Revision  Changes    Path
  1.25      +1 -0      jakarta-commons/collections/RELEASE-NOTES.html
  
  Index: RELEASE-NOTES.html
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/RELEASE-NOTES.html,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- RELEASE-NOTES.html	1 Apr 2004 22:43:12 -0000	1.24
  +++ RELEASE-NOTES.html	2 Apr 2004 21:15:05 -0000	1.25
  @@ -33,6 +33,7 @@
   <li>ReferenceMap - Changed to extend AbstractHashedMap, thus gaining a mapIterator()
and subclassability</li>
   <li>Fast3Map - Make Serializable [27946]</li>
   <li>Fast3Map - Add clone() method</li>
  +<li>FixedSizeMap - Make Serializable [18815]</li>
   <li>MultiKey - Add getKey(index) and size() methods and make constructor public</li>
   <li>MultiHashMap - Add five methods to improve the API</li>
   <li>AbstractHashedMap,AbstractLinkedMap - Add methods to access entry methods when
protected scope blocks</li>
  
  
  
  1.1                  jakarta-commons/collections/data/test/FixedSizeMap.fullCollection.version3.1.obj
  
  	<<Binary file>>
  
  
  1.1                  jakarta-commons/collections/data/test/FixedSizeMap.emptyCollection.version3.1.obj
  
  	<<Binary file>>
  
  
  1.6       +15 -1     jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java
  
  Index: TestFixedSizeMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestFixedSizeMap.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestFixedSizeMap.java	18 Feb 2004 01:20:38 -0000	1.5
  +++ TestFixedSizeMap.java	2 Apr 2004 21:15:05 -0000	1.6
  @@ -63,4 +63,18 @@
           return false;
       }
   
  +    public String getCompatibilityVersion() {
  +        return "3.1";
  +    }
  +
  +//    public void testCreate() throws Exception {
  +//        resetEmpty();
  +//        writeExternalFormToDisk(
  +//            (java.io.Serializable) map,
  +//            "D:/dev/collections/data/test/FixedSizeMap.emptyCollection.version3.1.obj");
  +//        resetFull();
  +//        writeExternalFormToDisk(
  +//            (java.io.Serializable) map,
  +//            "D:/dev/collections/data/test/FixedSizeMap.fullCollection.version3.1.obj");
  +//    }
   }
  
  
  
  1.6       +28 -3     jakarta-commons/collections/src/java/org/apache/commons/collections/map/FixedSizeMap.java
  
  Index: FixedSizeMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/map/FixedSizeMap.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FixedSizeMap.java	18 Feb 2004 01:13:19 -0000	1.5
  +++ FixedSizeMap.java	2 Apr 2004 21:15:05 -0000	1.6
  @@ -15,6 +15,10 @@
    */
   package org.apache.commons.collections.map;
   
  +import java.io.IOException;
  +import java.io.ObjectInputStream;
  +import java.io.ObjectOutputStream;
  +import java.io.Serializable;
   import java.util.Collection;
   import java.util.Iterator;
   import java.util.Map;
  @@ -44,7 +48,11 @@
    * @author Paul Jack
    */
   public class FixedSizeMap
  -        extends AbstractMapDecorator implements Map, BoundedMap {
  +        extends AbstractMapDecorator
  +        implements Map, BoundedMap, Serializable {
  +
  +    /** Serialization version */
  +    private static final long serialVersionUID = 7450927208116179316L;
   
       /**
        * Factory method to create a fixed size map.
  @@ -66,7 +74,24 @@
       protected FixedSizeMap(Map map) {
           super(map);
       }
  -    
  +
  +    //-----------------------------------------------------------------------
  +    /**
  +     * Write the map out using a custom routine.
  +     */
  +    private void writeObject(ObjectOutputStream out) throws IOException {
  +        out.defaultWriteObject();
  +        out.writeObject(map);
  +    }
  +
  +    /**
  +     * Read the map in using a custom routine.
  +     */
  +    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
  +        in.defaultReadObject();
  +        map = (Map) in.readObject();
  +    }
  +
       //-----------------------------------------------------------------------
       public Object put(Object key, Object value) {
           if (map.containsKey(key) == false) {
  
  
  

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


Mime
View raw message