/** * Rehashes the content of the table into a bigger table. * This method is called automatically when the hashtable's * size exceeds the threshold. */ private void rehash() { LongCache newHashtable = new LongCache(this.keyTable.length * 2); for (int i = this.keyTable.length; --i >= 0;) { long key = this.keyTable[i]; int value = this.valueTable[i]; if ((key != 0) || ((key == 0) && (value != 0))) { newHashtable.put(key, value); } } this.keyTable = newHashtable.keyTable; this.valueTable = newHashtable.valueTable; this.threshold = newHashtable.threshold; } /**
/** * Puts the specified element into the hashtable, using the specified * key. The element may be retrieved by doing a get() with the same key. * * @param key <CODE>long</CODE> the specified key in the hashtable * @param value <CODE>int</CODE> the specified element * @return int value */ public int putIfAbsent(long key, int value) { int index = hash(key), length = this.keyTable.length; while ((this.keyTable[index] != 0) || ((this.keyTable[index] == 0) && (this.valueTable[index] != 0))) { if (this.keyTable[index] == key) return this.valueTable[index]; if (++index == length) { index = 0; } } this.keyTable[index] = key; this.valueTable[index] = value; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) { rehash(); } return -value; // negative when added, assumes value is > 0 } /**
this.longCache = new LongCache(LONG_INITIAL_SIZE); if ((index = this.longCache.putIfAbsent(key, this.currentIndex)) < 0) { if ((index = -index) > 0xFFFF){ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
public void reset() { if (this.doubleCache != null) this.doubleCache.clear(); if (this.floatCache != null) this.floatCache.clear(); if (this.intCache != null) this.intCache.clear(); if (this.longCache != null) this.longCache.clear(); this.UTF8Cache.clear(); this.stringCache.clear(); this.methodsAndFieldsCache.clear(); this.classCache.clear(); this.nameAndTypeCacheForFieldsAndMethods.clear(); this.currentIndex = 1; this.currentOffset = 0; } public void resetForAttributeName(char[] attributeName, int constantPoolIndex, int constantPoolOffset) {
/** Returns true if the collection contains an element for the key. * * @param key <CODE>long</CODE> the key that we are looking for * @return boolean */ public boolean containsKey(long key) { int index = hash(key), length = this.keyTable.length; while ((this.keyTable[index] != 0) || ((this.keyTable[index] == 0) &&(this.valueTable[index] != 0))) { if (this.keyTable[index] == key) return true; if (++index == length) { index = 0; } } return false; } /**
/** * Converts to a rather lengthy String. * * @return String the ascii representation of the receiver */ public String toString() { int max = size(); StringBuffer buf = new StringBuffer(); buf.append("{"); //$NON-NLS-1$ for (int i = 0; i < max; ++i) { if ((this.keyTable[i] != 0) || ((this.keyTable[i] == 0) && (this.valueTable[i] != 0))) { buf.append(this.keyTable[i]).append("->").append(this.valueTable[i]); //$NON-NLS-1$ } if (i < max) { buf.append(", "); //$NON-NLS-1$ } } buf.append("}"); //$NON-NLS-1$ return buf.toString(); } }
this.longCache = new LongCache(LONG_INITIAL_SIZE); if ((index = this.longCache.putIfAbsent(key, this.currentIndex)) < 0) { if ((index = -index) > 0xFFFF){ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
public void reset() { if (this.doubleCache != null) this.doubleCache.clear(); if (this.floatCache != null) this.floatCache.clear(); if (this.intCache != null) this.intCache.clear(); if (this.longCache != null) this.longCache.clear(); this.UTF8Cache.clear(); this.stringCache.clear(); this.methodsAndFieldsCache.clear(); this.classCache.clear(); this.nameAndTypeCacheForFieldsAndMethods.clear(); this.currentIndex = 1; this.currentOffset = 0; } public void resetForAttributeName(char[] attributeName, int constantPoolIndex, int constantPoolOffset) {
/** Returns true if the collection contains an element for the key. * * @param key <CODE>long</CODE> the key that we are looking for * @return boolean */ public boolean containsKey(long key) { int index = hash(key), length = this.keyTable.length; while ((this.keyTable[index] != 0) || ((this.keyTable[index] == 0) &&(this.valueTable[index] != 0))) { if (this.keyTable[index] == key) return true; if (++index == length) { index = 0; } } return false; } /**
/** * Converts to a rather lengthy String. * * @return String the ascii representation of the receiver */ @Override public String toString() { int max = size(); StringBuffer buf = new StringBuffer(); buf.append("{"); //$NON-NLS-1$ for (int i = 0; i < max; ++i) { if ((this.keyTable[i] != 0) || ((this.keyTable[i] == 0) && (this.valueTable[i] != 0))) { buf.append(this.keyTable[i]).append("->").append(this.valueTable[i]); //$NON-NLS-1$ } if (i < max) { buf.append(", "); //$NON-NLS-1$ } } buf.append("}"); //$NON-NLS-1$ return buf.toString(); } }
/** * Puts the specified element into the hashtable, using the specified * key. The element may be retrieved by doing a get() with the same key. * * @param key <CODE>long</CODE> the specified key in the hashtable * @param value <CODE>int</CODE> the specified element * @return int value */ public int put(long key, int value) { int index = hash(key), length = this.keyTable.length; while ((this.keyTable[index] != 0) || ((this.keyTable[index] == 0) && (this.valueTable[index] != 0))) { if (this.keyTable[index] == key) return this.valueTable[index] = value; if (++index == length) { index = 0; } } this.keyTable[index] = key; this.valueTable[index] = value; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) { rehash(); } return value; } /**
/** * Rehashes the content of the table into a bigger table. * This method is called automatically when the hashtable's * size exceeds the threshold. */ private void rehash() { LongCache newHashtable = new LongCache(this.keyTable.length * 2); for (int i = this.keyTable.length; --i >= 0;) { long key = this.keyTable[i]; int value = this.valueTable[i]; if ((key != 0) || ((key == 0) && (value != 0))) { newHashtable.put(key, value); } } this.keyTable = newHashtable.keyTable; this.valueTable = newHashtable.valueTable; this.threshold = newHashtable.threshold; } /**
this.longCache = new LongCache(LONG_INITIAL_SIZE); if ((index = this.longCache.putIfAbsent(key, this.currentIndex)) < 0) { if ((index = -index) > 0xFFFF){ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
public void reset() { if (this.doubleCache != null) this.doubleCache.clear(); if (this.floatCache != null) this.floatCache.clear(); if (this.intCache != null) this.intCache.clear(); if (this.longCache != null) this.longCache.clear(); this.UTF8Cache.clear(); this.stringCache.clear(); this.methodsAndFieldsCache.clear(); this.classCache.clear(); this.nameAndTypeCacheForFieldsAndMethods.clear(); this.currentIndex = 1; this.currentOffset = 0; } public void resetForAttributeName(char[] attributeName, int constantPoolIndex, int constantPoolOffset) {
/** Returns true if the collection contains an element for the key. * * @param key <CODE>long</CODE> the key that we are looking for * @return boolean */ public boolean containsKey(long key) { int index = hash(key), length = this.keyTable.length; while ((this.keyTable[index] != 0) || ((this.keyTable[index] == 0) &&(this.valueTable[index] != 0))) { if (this.keyTable[index] == key) return true; if (++index == length) { index = 0; } } return false; } /**
/** * Converts to a rather lengthy String. * * @return String the ascii representation of the receiver */ public String toString() { int max = size(); StringBuffer buf = new StringBuffer(); buf.append("{"); //$NON-NLS-1$ for (int i = 0; i < max; ++i) { if ((this.keyTable[i] != 0) || ((this.keyTable[i] == 0) && (this.valueTable[i] != 0))) { buf.append(this.keyTable[i]).append("->").append(this.valueTable[i]); //$NON-NLS-1$ } if (i < max) { buf.append(", "); //$NON-NLS-1$ } } buf.append("}"); //$NON-NLS-1$ return buf.toString(); } }
/** * Puts the specified element into the hashtable, using the specified * key. The element may be retrieved by doing a get() with the same key. * * @param key <CODE>long</CODE> the specified key in the hashtable * @param value <CODE>int</CODE> the specified element * @return int value */ public int put(long key, int value) { int index = hash(key), length = this.keyTable.length; while ((this.keyTable[index] != 0) || ((this.keyTable[index] == 0) && (this.valueTable[index] != 0))) { if (this.keyTable[index] == key) return this.valueTable[index] = value; if (++index == length) { index = 0; } } this.keyTable[index] = key; this.valueTable[index] = value; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) { rehash(); } return value; } /**
/** * Rehashes the content of the table into a bigger table. * This method is called automatically when the hashtable's * size exceeds the threshold. */ private void rehash() { LongCache newHashtable = new LongCache(this.keyTable.length * 2); for (int i = this.keyTable.length; --i >= 0;) { long key = this.keyTable[i]; int value = this.valueTable[i]; if ((key != 0) || ((key == 0) && (value != 0))) { newHashtable.put(key, value); } } this.keyTable = newHashtable.keyTable; this.valueTable = newHashtable.valueTable; this.threshold = newHashtable.threshold; } /**
this.longCache = new LongCache(LONG_INITIAL_SIZE); if ((index = this.longCache.putIfAbsent(key, this.currentIndex)) < 0) { if ((index = -index) > 0xFFFF){ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
public void reset() { if (this.doubleCache != null) this.doubleCache.clear(); if (this.floatCache != null) this.floatCache.clear(); if (this.intCache != null) this.intCache.clear(); if (this.longCache != null) this.longCache.clear(); this.UTF8Cache.clear(); this.stringCache.clear(); this.methodsAndFieldsCache.clear(); this.classCache.clear(); this.nameAndTypeCacheForFieldsAndMethods.clear(); this.currentIndex = 1; this.currentOffset = 0; } public void resetForAttributeName(char[] attributeName, int constantPoolIndex, int constantPoolOffset) {