2004/01/13 03:59:35
[org.ibex.core.git] / src / org / xwt / util / Hash.java
index e36f667..09ed008 100644 (file)
@@ -1,4 +1,10 @@
-// Copyright 2003 Adam Megacz, see the COPYING file for licensing [GPL]
+// Copyright (C) 2003 Adam Megacz <adam@xwt.org> all rights reserved.
+//
+// You may modify, copy, and redistribute this code under the terms of
+// the GNU Library Public License version 2.1, with the exception of
+// the portion of clause 6a after the semicolon (aka the "obnoxious
+// relink clause")
+
 package org.xwt.util;
 
 import java.util.*;
@@ -51,9 +57,7 @@ public class Hash {
     }
 
     /** returns all the primary keys in the table */
-    public Enumeration keys() {
-        return new HashEnum(this);
-    }
+    public Enumeration keys() { return new HashEnum(); }
 
     public Hash() { this(25, 3); }
     public Hash(int initialcapacity, int loadFactor) {
@@ -146,25 +150,21 @@ public class Hash {
         vals[dest] = v;
     }
 
-    class HashEnum implements java.util.Enumeration {
-        private final Hash parent;
+    private class HashEnum implements java.util.Enumeration {
         private int iterator = 0;
         private int found = 0;
         
-        public HashEnum (Hash parent) { this.parent = parent; }
+        public HashEnum () { }
         
         public boolean hasMoreElements() {
-            return found < parent.usedslots;
+            return found < usedslots;
         }
 
         public Object nextElement() {
             if (!hasMoreElements()) throw new java.util.NoSuchElementException();
 
             Object o = null;
-            while (o == null) {
-                o = parent.keys1[iterator++];
-            }
-
+            while (o == null) o = keys1[iterator++];
             if (o == null) throw new IllegalStateException("Didn't find an element, when I should have.");
             found++;