hacks ot make Hash serializable
authoradam <adam@megacz.com>
Tue, 19 Oct 2004 07:49:19 +0000 (07:49 +0000)
committeradam <adam@megacz.com>
Tue, 19 Oct 2004 07:49:19 +0000 (07:49 +0000)
darcs-hash:20041019074919-5007d-540daced6a4702f8b74976b20b0310bc201c33cd.gz

src/org/ibex/util/Hash.java
src/org/ibex/util/Vec.java

index 4b38870..6952e82 100644 (file)
@@ -16,13 +16,14 @@ import java.util.*;
  *
  *  Not threadsafe.
  */
-public class Hash {
+public class Hash implements java.io.Serializable {
     /** this object is inserted as key in a slot when the
      *  corresponding value is removed -- this ensures that the
      *  probing sequence for any given key remains the same even if
      *  other keys are removed.
      */
-    private static Object placeholder = new Object();
+    // FIXME: this should have been static except that that makes it nonserializable
+    private Object placeholder = new java.io.Serializable() { };
 
     /** the number of entries with at least one non-null key */
     private int usedslots = 0;
index d3fe00e..6d1fbd5 100644 (file)
@@ -71,7 +71,7 @@ public final class Vec implements Serializable {
     public void push(Object o) { addElement(o); }
     public Object pop() {
         Object ret = lastElement();
-        if (size > 0) store[size--] = null;
+        if (size > 0) store[--size] = null;
         return ret;
     }