private void rehash() { StringSet newSet = new StringSet(this.elementSize * 2); // double the number of expected elements String current; for (int i = this.values.length; --i >= 0;) if ((current = this.values[i]) != null) newSet.add(current); this.values = newSet.values; this.elementSize = newSet.elementSize; this.threshold = newSet.threshold; }
@Override public void dispose() { if (this.structualChanges != null) { this.structualChanges.clear(); this.structualChanges = null; } if (this.removedTypes != null) { this.removedTypes.clear(); this.removedTypes = null; } if (this.descriptionChanges != null) { this.descriptionChanges.clear(); this.descriptionChanges = null; } if (this.descriptionDepedents != null) { this.descriptionDepedents.clear(); this.descriptionDepedents = null; } }
@Override public boolean containsStructuralChange(String typename) { if (typename == null) { return false; } return structualChanges != null && structualChanges.includes(typename.replace('/', '.')); }
protected void resetCollections() { if (this.sourceFiles == null) { this.sourceFiles = new ArrayList(33); this.previousSourceFiles = null; this.qualifiedStrings = new StringSet(3); this.simpleStrings = new StringSet(3); this.rootStrings = new StringSet(3); this.hasStructuralChanges = false; this.compileLoop = 0; } else { this.previousSourceFiles = this.sourceFiles.isEmpty() ? null : (ArrayList) this.sourceFiles.clone(); this.sourceFiles.clear(); this.qualifiedStrings.clear(); this.simpleStrings.clear(); this.rootStrings.clear(); this.workQueue.clear(); } }
var set = new StringSet(); set.add("foo"); set.add("bar"); alert(set.contains("foo")); // true alert(set.contains("baz")); // false set.values(); // ["foo", "bar"], though not necessarily in that order set.remove("foo"); set.values(); // ["bar"]
void wasStructurallyChanged(String typeName) { if (this.structurallyChangedTypes != null) { if (this.structurallyChangedTypes.elementSize > MaxStructurallyChangedTypes) this.structurallyChangedTypes = null; // too many to keep track of else this.structurallyChangedTypes.add(typeName); } }
public boolean add(String value) { int length = this.values.length; int index = (value.hashCode() & 0x7FFFFFFF) % length; String current; while ((current = this.values[index]) != null) { if (value.equals(current)) return false; // did not add it since it already existed if (++index == length) index = 0; } this.values[index] = value; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) rehash(); return true; }
protected void resetCollections() { if (this.sourceFiles == null) { this.sourceFiles = new ArrayList(33); this.previousSourceFiles = null; this.qualifiedStrings = new StringSet(3); this.simpleStrings = new StringSet(3); this.rootStrings = new StringSet(3); this.hasStructuralChanges = false; this.compileLoop = 0; } else { this.previousSourceFiles = this.sourceFiles.isEmpty() ? null : (ArrayList) this.sourceFiles.clone(); this.sourceFiles.clear(); this.qualifiedStrings.clear(); this.simpleStrings.clear(); this.rootStrings.clear(); this.workQueue.clear(); } }
function StringSet() { this.values = {}; this.add = function(value) { value = value.toUpperCase(); // use UpperCase for string normalization because of how casing rules work in different languages, especially Turkish this.values[ value ] = true; // use bool values as stubs }; this.contains = function(value) { value = value.toUpperCase(); return value in this.values; // JavaScript has a fast `in` operator which runs in `O(1)` time } } var foo = new StringSet(); foo.add("bar"); assert( foo.contains("bar") );
void wasStructurallyChanged(String typeName) { if (this.structurallyChangedTypes != null) { if (this.structurallyChangedTypes.elementSize > MaxStructurallyChangedTypes) this.structurallyChangedTypes = null; // too many to keep track of else this.structurallyChangedTypes.add(typeName); } }
public boolean add(String value) { int length = this.values.length; int index = (value.hashCode() & 0x7FFFFFFF) % length; String current; while ((current = this.values[index]) != null) { if (value.equals(current)) return false; // did not add it since it already existed if (++index == length) index = 0; } this.values[index] = value; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) rehash(); return true; }
private void rehash() { StringSet newSet = new StringSet(this.elementSize * 2); // double the number of expected elements String current; for (int i = this.values.length; --i >= 0;) if ((current = this.values[i]) != null) newSet.add(current); this.values = newSet.values; this.elementSize = newSet.elementSize; this.threshold = newSet.threshold; }
protected void resetCollections() { if (this.sourceFiles == null) { this.sourceFiles = new ArrayList(33); this.previousSourceFiles = null; this.qualifiedStrings = new StringSet(3); this.simpleStrings = new StringSet(3); this.rootStrings = new StringSet(3); this.hasStructuralChanges = false; this.compileLoop = 0; } else { this.previousSourceFiles = this.sourceFiles.isEmpty() ? null : (ArrayList) this.sourceFiles.clone(); this.sourceFiles.clear(); this.qualifiedStrings.clear(); this.simpleStrings.clear(); this.rootStrings.clear(); this.workQueue.clear(); } }
void tagAsStructurallyChanged() { this.previousStructuralBuildTime = this.lastStructuralBuildTime; this.structurallyChangedTypes = new StringSet(7); this.lastStructuralBuildTime = computeStructuralBuildTime(this.previousStructuralBuildTime); }
@Override public boolean containsDescriptionDependent(String typename) { if (typename == null) { return false; } return descriptionDepedents != null && descriptionDepedents.includes(typename.replace('/', '.')); }
void wasStructurallyChanged(String typeName) { if (this.structurallyChangedTypes != null) { if (this.structurallyChangedTypes.elementSize > MaxStructurallyChangedTypes) this.structurallyChangedTypes = null; // too many to keep track of else this.structurallyChangedTypes.add(typeName); } }
public boolean add(String value) { int length = this.values.length; int index = (value.hashCode() & 0x7FFFFFFF) % length; String current; while ((current = this.values[index]) != null) { if (value.equals(current)) return false; // did not add it since it already existed if (++index == length) index = 0; } this.values[index] = value; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) rehash(); return true; }
private void rehash() { StringSet newSet = new StringSet(this.elementSize * 2); // double the number of expected elements String current; for (int i = this.values.length; --i >= 0;) if ((current = this.values[i]) != null) newSet.add(current); this.values = newSet.values; this.elementSize = newSet.elementSize; this.threshold = newSet.threshold; }
protected void resetCollections() { if (this.sourceFiles == null) { this.sourceFiles = new ArrayList(33); this.previousSourceFiles = null; this.qualifiedStrings = new StringSet(3); this.simpleStrings = new StringSet(3); this.rootStrings = new StringSet(3); this.hasStructuralChanges = false; this.compileLoop = 0; } else { this.previousSourceFiles = this.sourceFiles.isEmpty() ? null : (ArrayList) this.sourceFiles.clone(); this.sourceFiles.clear(); this.qualifiedStrings.clear(); this.simpleStrings.clear(); this.rootStrings.clear(); this.workQueue.clear(); } }
void tagAsStructurallyChanged() { this.previousStructuralBuildTime = this.lastStructuralBuildTime; this.structurallyChangedTypes = new StringSet(7); this.lastStructuralBuildTime = computeStructuralBuildTime(this.previousStructuralBuildTime); }