if (categoryName != null) { SimpleWordSet wordSet = (SimpleWordSet) wordSets[i]; HashtableOfObject wordsToDocs = (HashtableOfObject) this.categoryTables.get(categoryName); if (wordsToDocs == null) this.categoryTables.put(categoryName, wordsToDocs = new HashtableOfObject(wordSet.elementSize)); char[] word = words[j]; if (word != null) { Object o = wordsToDocs.get(word); if (o == null) { wordsToDocs.putUnsafely(word, new int[] {newPosition}); } else if (o instanceof IntList) { ((IntList) o).add(newPosition); IntList list = new IntList((int[]) o); list.add(newPosition); wordsToDocs.put(word, list);
private void mergeCategories(DiskIndex onDisk, int[] positions, FileOutputStream stream) throws IOException { // at this point, this.categoryTables contains the names -> wordsToDocs added in copyQueryResults() char[][] oldNames = onDisk.categoryOffsets.keyTable; for (int i = 0, l = oldNames.length; i < l; i++) { char[] oldName = oldNames[i]; if (oldName != null && !this.categoryTables.containsKey(oldName)) this.categoryTables.put(oldName, null); } char[][] categoryNames = this.categoryTables.keyTable; for (int i = 0, l = categoryNames.length; i < l; i++) if (categoryNames[i] != null) mergeCategory(categoryNames[i], onDisk, positions, stream); this.categoryTables = null; } private void mergeCategory(char[] categoryName, DiskIndex onDisk, int[] positions, FileOutputStream stream) throws IOException {
boolean resolvedRequestedSourcesAndKeys(int unitIndexToProcess) { if (unitIndexToProcess < this.requestedSources.size() && unitIndexToProcess < this.requestedKeys.size()) return false; // must process at least this many units before checking to see if all are done Object[] sources = this.requestedSources.valueTable; for (int i = 0, l = sources.length; i < l; i++) if (sources[i] != null) return false; Object[] keys = this.requestedKeys.valueTable; for (int i = 0, l = keys.length; i < l; i++) if (keys[i] != null) return false; return true; }
private void rehash() { HashtableOfObject newHashtable = new HashtableOfObject(this.elementSize * 2); // double the number of expected elements char[] currentKey; for (int i = this.keyTable.length; --i >= 0;) if ((currentKey = this.keyTable[i]) != null) newHashtable.putUnsafely(currentKey, this.valueTable[i]); this.keyTable = newHashtable.keyTable; this.valueTable = newHashtable.valueTable; this.threshold = newHashtable.threshold; }
private void rehash() { HashtableOfObject newHashtable = new HashtableOfObject(this.elementSize * 2); // double the number of expected elements char[] currentKey; for (int i = this.keyTable.length; --i >= 0;) if ((currentKey = this.keyTable[i]) != null) newHashtable.put(currentKey, this.valueTable[i]); this.keyTable = newHashtable.keyTable; this.valueTable = newHashtable.valueTable; this.threshold = newHashtable.threshold; }
void addBridgeMethodCandidate(MethodBinding overriddenMethod) { MethodBinding[] existing = (MethodBinding[])this.inheritedOverriddenMethods.get(overriddenMethod.selector); if (existing == null) { existing = new MethodBinding[]{overriddenMethod}; } else { int length = existing.length; System.arraycopy(existing, 0, existing = new MethodBinding[length + 1], 0, length); existing[length] = overriddenMethod; } this.inheritedOverriddenMethods.put(overriddenMethod.selector, existing); }
public boolean resolve(Scope scope) { boolean errorsExist = resolvePackageReference(scope) == null; if (this.isQualified()) { HashtableOfObject modules = new HashtableOfObject(this.targets.length); for (int i = 0; i < this.targets.length; i++) { ModuleReference ref = this.targets[i]; if (modules.containsKey(ref.moduleName)) { scope.problemReporter().duplicateModuleReference(IProblem.DuplicateModuleRef, ref); errorsExist = true; } else { ref.resolve(scope.compilationUnitScope()); modules.put(ref.moduleName, ref); } } } return !errorsExist; } protected int computeSeverity(int problemId) {
public Object put(char[] key, Object value) { int length = this.keyTable.length, index = CharOperation.hashCode(key) % length; int keyLength = key.length; char[] currentKey; while ((currentKey = this.keyTable[index]) != null) { if (currentKey.length == keyLength && CharOperation.equals(currentKey, 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; }
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) {
public BindingKeyResolver(String key, Compiler compiler, LookupEnvironment environment) { super(key); this.compiler = compiler; this.environment = environment; this.resolvedUnits = new HashtableOfObject(); }
public void process(CompilationUnitDeclaration unit, int i) { // don't resolve a second time the same unit (this would create the same binding twice) char[] fileName = unit.compilationResult.getFileName(); if (this.requestedKeys.get(fileName) == null && this.requestedSources.get(fileName) == null) super.process(unit, i); } /*
void addBridgeMethodCandidate(MethodBinding overriddenMethod) { MethodBinding[] existing = (MethodBinding[])this.inheritedOverriddenMethods.get(overriddenMethod.selector); if (existing == null) { existing = new MethodBinding[]{overriddenMethod}; } else { int length = existing.length; System.arraycopy(existing, 0, existing = new MethodBinding[length + 1], 0, length); existing[length] = overriddenMethod; } this.inheritedOverriddenMethods.put(overriddenMethod.selector, existing); }
private void rehash() { HashtableOfObject newHashtable = new HashtableOfObject(this.elementSize * 2); // double the number of expected elements char[] currentKey; for (int i = this.keyTable.length; --i >= 0;) if ((currentKey = this.keyTable[i]) != null) newHashtable.putUnsafely(currentKey, this.valueTable[i]); this.keyTable = newHashtable.keyTable; this.valueTable = newHashtable.valueTable; this.threshold = newHashtable.threshold; }
public boolean resolve(Scope scope) { boolean errorsExist = resolvePackageReference(scope) == null; if (this.isQualified()) { HashtableOfObject modules = new HashtableOfObject(this.targets.length); for (int i = 0; i < this.targets.length; i++) { ModuleReference ref = this.targets[i]; if (modules.containsKey(ref.moduleName)) { scope.problemReporter().duplicateModuleReference(IProblem.DuplicateModuleRef, ref); errorsExist = true; } else { ref.resolve(scope.compilationUnitScope()); modules.put(ref.moduleName, ref); } } } return !errorsExist; } protected int computeSeverity(int problemId) {
public Object removeKey(char[] key) { int length = this.keyTable.length, index = CharOperation.hashCode(key) % length; int keyLength = key.length; char[] currentKey; while ((currentKey = this.keyTable[index]) != null) { if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) { Object value = this.valueTable[index]; this.elementSize--; this.keyTable[index] = null; this.valueTable[index] = null; rehash(); return value; } if (++index == length) { index = 0; } } return null; }
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) {
public BindingKeyResolver(String key, Compiler compiler, LookupEnvironment environment) { super(key); this.compiler = compiler; this.environment = environment; this.resolvedUnits = new HashtableOfObject(); }
public void process(CompilationUnitDeclaration unit, int i) { // don't resolve a second time the same unit (this would create the same binding twice) char[] fileName = unit.compilationResult.getFileName(); if (this.requestedKeys.get(fileName) == null && this.requestedSources.get(fileName) == null) super.process(unit, i); } /*
if (categoryName != null) { SimpleWordSet wordSet = (SimpleWordSet) wordSets[i]; HashtableOfObject wordsToDocs = (HashtableOfObject) this.categoryTables.get(categoryName); if (wordsToDocs == null) this.categoryTables.put(categoryName, wordsToDocs = new HashtableOfObject(wordSet.elementSize)); char[] word = words[j]; if (word != null) { Object o = wordsToDocs.get(word); if (o == null) { wordsToDocs.putUnsafely(word, new int[] {newPosition}); } else if (o instanceof IntList) { ((IntList) o).add(newPosition); IntList list = new IntList((int[]) o); list.add(newPosition); wordsToDocs.put(word, list);
private void mergeCategories(DiskIndex onDisk, int[] positions, FileOutputStream stream) throws IOException { // at this point, this.categoryTables contains the names -> wordsToDocs added in copyQueryResults() char[][] oldNames = onDisk.categoryOffsets.keyTable; for (int i = 0, l = oldNames.length; i < l; i++) { char[] oldName = oldNames[i]; if (oldName != null && !this.categoryTables.containsKey(oldName)) this.categoryTables.put(oldName, null); } char[][] categoryNames = this.categoryTables.keyTable; for (int i = 0, l = categoryNames.length; i < l; i++) if (categoryNames[i] != null) mergeCategory(categoryNames[i], onDisk, positions, stream); this.categoryTables = null; } private void mergeCategory(char[] categoryName, DiskIndex onDisk, int[] positions, FileOutputStream stream) throws IOException {