private void rehash() { HashSetOfInt newHashSet = new HashSetOfInt(this.elementSize * 2); // double the number of expected elements int currentElement; for (int i = this.set.length; --i >= 0;) if ((currentElement = this.set[i]) != 0) newHashSet.add(currentElement); this.set = newHashSet.set; this.threshold = newHashSet.threshold; }
public int add(int element) { int length = this.set.length; int index = element % length; int currentElement; while ((currentElement = this.set[index]) != 0) { if (currentElement == element) return this.set[index] = element; if (++index == length) { index = 0; } } this.set[index] = element; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) rehash(); return element; }
public void recordStringLiteral(StringLiteral literal, boolean fromRecovery) { if (this.stringLiteralsStart != null) { if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart); } else if (fromRecovery) { this.stringLiteralsStart = new HashSetOfInt(this.stringLiteralsPtr + STRING_LITERALS_INCREMENT); for (int i = 0; i < this.stringLiteralsPtr; i++) { this.stringLiteralsStart.add(this.stringLiterals[i].sourceStart); if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart);
public void recordStringLiteral(StringLiteral literal, boolean fromRecovery) { if (this.stringLiteralsStart != null) { if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart); } else if (fromRecovery) { this.stringLiteralsStart = new HashSetOfInt(this.stringLiteralsPtr + STRING_LITERALS_INCREMENT); for (int i = 0; i < this.stringLiteralsPtr; i++) { this.stringLiteralsStart.add(this.stringLiterals[i].sourceStart); if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart);
public void recordStringLiteral(StringLiteral literal, boolean fromRecovery) { if (this.stringLiteralsStart != null) { if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart); } else if (fromRecovery) { this.stringLiteralsStart = new HashSetOfInt(this.stringLiteralsPtr + STRING_LITERALS_INCREMENT); for (int i = 0; i < this.stringLiteralsPtr; i++) { this.stringLiteralsStart.add(this.stringLiterals[i].sourceStart); if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart);
private void rehash() { HashSetOfInt newHashSet = new HashSetOfInt(this.elementSize * 2); // double the number of expected elements int currentElement; for (int i = this.set.length; --i >= 0;) if ((currentElement = this.set[i]) != 0) newHashSet.add(currentElement); this.set = newHashSet.set; this.threshold = newHashSet.threshold; }
public int add(int element) { int length = this.set.length; int index = element % length; int currentElement; while ((currentElement = this.set[index]) != 0) { if (currentElement == element) return this.set[index] = element; if (++index == length) { index = 0; } } this.set[index] = element; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) rehash(); return element; }
public void recordStringLiteral(StringLiteral literal, boolean fromRecovery) { if (this.stringLiteralsStart != null) { if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart); } else if (fromRecovery) { this.stringLiteralsStart = new HashSetOfInt(this.stringLiteralsPtr + STRING_LITERALS_INCREMENT); for (int i = 0; i < this.stringLiteralsPtr; i++) { this.stringLiteralsStart.add(this.stringLiterals[i].sourceStart); if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart);
private void rehash() { HashSetOfInt newHashSet = new HashSetOfInt(this.elementSize * 2); // double the number of expected elements int currentElement; for (int i = this.set.length; --i >= 0;) if ((currentElement = this.set[i]) != 0) newHashSet.add(currentElement); this.set = newHashSet.set; this.threshold = newHashSet.threshold; }
public int remove(int element) { int length = this.set.length; int index = element % length; int currentElement; while ((currentElement = this.set[index]) != 0) { if (currentElement == element) { int existing = this.set[index]; this.elementSize--; this.set[index] = 0; rehash(); return existing; } if (++index == length) { index = 0; } } return 0; }
public void recordStringLiteral(StringLiteral literal, boolean fromRecovery) { if (this.stringLiteralsStart != null) { if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart); } else if (fromRecovery) { this.stringLiteralsStart = new HashSetOfInt(this.stringLiteralsPtr + STRING_LITERALS_INCREMENT); for (int i = 0; i < this.stringLiteralsPtr; i++) { this.stringLiteralsStart.add(this.stringLiterals[i].sourceStart); if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart);
private void rehash() { HashSetOfInt newHashSet = new HashSetOfInt(this.elementSize * 2); // double the number of expected elements int currentElement; for (int i = this.set.length; --i >= 0;) if ((currentElement = this.set[i]) != 0) newHashSet.add(currentElement); this.set = newHashSet.set; this.threshold = newHashSet.threshold; }
public int add(int element) { int length = this.set.length; int index = element % length; int currentElement; while ((currentElement = this.set[index]) != 0) { if (currentElement == element) return this.set[index] = element; if (++index == length) { index = 0; } } this.set[index] = element; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) rehash(); return element; }
public void recordStringLiteral(StringLiteral literal, boolean fromRecovery) { if (this.stringLiteralsStart != null) { if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart); } else if (fromRecovery) { this.stringLiteralsStart = new HashSetOfInt(this.stringLiteralsPtr + STRING_LITERALS_INCREMENT); for (int i = 0; i < this.stringLiteralsPtr; i++) { this.stringLiteralsStart.add(this.stringLiterals[i].sourceStart); if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart);
private void rehash() { HashSetOfInt newHashSet = new HashSetOfInt(this.elementSize * 2); // double the number of expected elements int currentElement; for (int i = this.set.length; --i >= 0;) if ((currentElement = this.set[i]) != 0) newHashSet.add(currentElement); this.set = newHashSet.set; this.threshold = newHashSet.threshold; }
public int add(int element) { int length = this.set.length; int index = element % length; int currentElement; while ((currentElement = this.set[index]) != 0) { if (currentElement == element) return this.set[index] = element; if (++index == length) { index = 0; } } this.set[index] = element; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) rehash(); return element; }
public void recordStringLiteral(StringLiteral literal, boolean fromRecovery) { if (this.stringLiteralsStart != null) { if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart); } else if (fromRecovery) { this.stringLiteralsStart = new HashSetOfInt(this.stringLiteralsPtr + STRING_LITERALS_INCREMENT); for (int i = 0; i < this.stringLiteralsPtr; i++) { this.stringLiteralsStart.add(this.stringLiterals[i].sourceStart); if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart);
private void rehash() { HashSetOfInt newHashSet = new HashSetOfInt(this.elementSize * 2); // double the number of expected elements int currentElement; for (int i = this.set.length; --i >= 0;) if ((currentElement = this.set[i]) != 0) newHashSet.add(currentElement); this.set = newHashSet.set; this.threshold = newHashSet.threshold; }
public int add(int element) { int length = this.set.length; int index = element % length; int currentElement; while ((currentElement = this.set[index]) != 0) { if (currentElement == element) return this.set[index] = element; if (++index == length) { index = 0; } } this.set[index] = element; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) rehash(); return element; }
public void recordStringLiteral(StringLiteral literal, boolean fromRecovery) { if (this.stringLiteralsStart != null) { if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart); } else if (fromRecovery) { this.stringLiteralsStart = new HashSetOfInt(this.stringLiteralsPtr + STRING_LITERALS_INCREMENT); for (int i = 0; i < this.stringLiteralsPtr; i++) { this.stringLiteralsStart.add(this.stringLiterals[i].sourceStart); if (this.stringLiteralsStart.contains(literal.sourceStart)) return; this.stringLiteralsStart.add(literal.sourceStart);