X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfIntValues.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfIntValues.java index f7e6bb7..1423f9e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfIntValues.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/util/HashtableOfIntValues.java @@ -16,14 +16,16 @@ import net.sourceforge.phpdt.core.compiler.CharOperation; * Hashtable of {char[] --> int} */ public final class HashtableOfIntValues implements Cloneable { - + public static final int NO_VALUE = Integer.MIN_VALUE; - + // to avoid using Enumerations, walk the individual tables skipping nulls public char[] keyTable[]; + public int valueTable[]; public int elementSize; // number of elements in the table + int threshold; public HashtableOfIntValues() { @@ -33,7 +35,8 @@ public final class HashtableOfIntValues implements Cloneable { public HashtableOfIntValues(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++; @@ -62,7 +65,8 @@ public final class HashtableOfIntValues implements Cloneable { int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { - if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) + if (currentKey.length == keyLength + && CharOperation.equals(currentKey, key)) return true; index = (index + 1) % keyTable.length; } @@ -75,7 +79,8 @@ public final class HashtableOfIntValues implements Cloneable { int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { - if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) + if (currentKey.length == keyLength + && CharOperation.equals(currentKey, key)) return valueTable[index]; index = (index + 1) % keyTable.length; } @@ -88,7 +93,8 @@ public final class HashtableOfIntValues implements Cloneable { int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { - if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) + if (currentKey.length == keyLength + && CharOperation.equals(currentKey, key)) return valueTable[index] = value; index = (index + 1) % keyTable.length; } @@ -107,7 +113,8 @@ public final class HashtableOfIntValues implements Cloneable { int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { - if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) { + if (currentKey.length == keyLength + && CharOperation.equals(currentKey, key)) { int value = valueTable[index]; elementSize--; keyTable[index] = null; @@ -122,7 +129,8 @@ public final class HashtableOfIntValues implements Cloneable { private void rehash() { - HashtableOfIntValues newHashtable = new HashtableOfIntValues(elementSize * 2); // double the number of expected elements + HashtableOfIntValues newHashtable = new HashtableOfIntValues( + elementSize * 2); // double the number of expected elements char[] currentKey; for (int i = keyTable.length; --i >= 0;) if ((currentKey = keyTable[i]) != null) @@ -142,7 +150,7 @@ public final class HashtableOfIntValues implements Cloneable { char[] key; for (int i = 0, length = valueTable.length; i < length; i++) if ((key = keyTable[i]) != null) - s += new String(key) + " -> " + valueTable[i] + "\n"; //$NON-NLS-2$ //$NON-NLS-1$ + s += new String(key) + " -> " + valueTable[i] + "\n"; //$NON-NLS-2$ //$NON-NLS-1$ return s; } }