1) Fixed issue #705: Take the global 'Undo history size' to overwrite the default...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / util / HashtableOfObject.java
index a739830..09e959a 100644 (file)
@@ -16,12 +16,14 @@ import net.sourceforge.phpdt.core.compiler.CharOperation;
  * Hashtable of {char[] --> Object }
  */
 public final class HashtableOfObject implements Cloneable {
-       
+
        // to avoid using Enumerations, walk the individual tables skipping nulls
        public char[] keyTable[];
+
        public Object valueTable[];
 
        public int elementSize; // number of elements in the table
+
        int threshold;
 
        public HashtableOfObject() {
@@ -31,7 +33,8 @@ public final class HashtableOfObject implements Cloneable {
        public HashtableOfObject(int size) {
 
                this.elementSize = 0;
-               this.threshold = size; // size represents the expected number of elements
+               this.threshold = size; // size represents the expected number of
+                                                               // elements
                int extraRoom = (int) (size * 1.75f);
                if (this.threshold == extraRoom)
                        extraRoom++;
@@ -61,7 +64,7 @@ public final class HashtableOfObject implements Cloneable {
                char[] currentKey;
                while ((currentKey = keyTable[index]) != null) {
                        if (currentKey.length == keyLength
-                               && CharOperation.prefixEquals(currentKey, key))
+                                       && CharOperation.prefixEquals(currentKey, key))
                                return true;
                        index = (index + 1) % keyTable.length;
                }
@@ -75,7 +78,7 @@ public final class HashtableOfObject implements Cloneable {
                char[] currentKey;
                while ((currentKey = keyTable[index]) != null) {
                        if (currentKey.length == keyLength
-                               && CharOperation.prefixEquals(currentKey, key))
+                                       && CharOperation.prefixEquals(currentKey, key))
                                return valueTable[index];
                        index = (index + 1) % keyTable.length;
                }
@@ -89,7 +92,7 @@ public final class HashtableOfObject implements Cloneable {
                char[] currentKey;
                while ((currentKey = keyTable[index]) != null) {
                        if (currentKey.length == keyLength
-                               && CharOperation.prefixEquals(currentKey, key))
+                                       && CharOperation.prefixEquals(currentKey, key))
                                return valueTable[index] = value;
                        index = (index + 1) % keyTable.length;
                }
@@ -109,14 +112,14 @@ public final class HashtableOfObject implements Cloneable {
                char[] currentKey;
                while ((currentKey = keyTable[index]) != null) {
                        if (currentKey.length == keyLength
-                               && CharOperation.prefixEquals(currentKey, key)) {
-                                       Object value = valueTable[index];
-                                       elementSize--;
-                                       keyTable[index] = null;
-                                       valueTable[index] = null;
-                                       rehash();
-                                       return value;
-                               }
+                                       && CharOperation.prefixEquals(currentKey, key)) {
+                               Object value = valueTable[index];
+                               elementSize--;
+                               keyTable[index] = null;
+                               valueTable[index] = null;
+                               rehash();
+                               return value;
+                       }
                        index = (index + 1) % keyTable.length;
                }
                return null;
@@ -124,7 +127,12 @@ public final class HashtableOfObject implements Cloneable {
 
        private void rehash() {
 
-               HashtableOfObject newHashtable = new HashtableOfObject(elementSize * 2);                // double the number of expected elements
+               HashtableOfObject newHashtable = new HashtableOfObject(elementSize * 2); // double
+                                                                                                                                                                       // the
+                                                                                                                                                                       // number
+                                                                                                                                                                       // of
+                                                                                                                                                                       // expected
+                                                                                                                                                                       // elements
                char[] currentKey;
                for (int i = keyTable.length; --i >= 0;)
                        if ((currentKey = keyTable[i]) != null)
@@ -144,7 +152,8 @@ public final class HashtableOfObject implements Cloneable {
                Object object;
                for (int i = 0, length = valueTable.length; i < length; i++)
                        if ((object = valueTable[i]) != null)
-                               s += new String(keyTable[i]) + " -> " + object.toString() + "\n";       //$NON-NLS-2$ //$NON-NLS-1$
+                               s += new String(keyTable[i])
+                                               + " -> " + object.toString() + "\n"; //$NON-NLS-2$ //$NON-NLS-1$
                return s;
        }
 }