Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
62 | 2 | 6 | 0.952 | class_body_declarations[4] |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 62 | 110 | plugins/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/WeakHashSet.java |
2 | 62 | 112 | plugins/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/WeakHashSetOfCharArray.java |
| ||||
private void cleanupGarbageCollectedValues() { HashableWeakReference toBeRemoved; while ((toBeRemoved = (HashableWeakReference) this.referenceQueue.poll()) != null) { int hashCode = toBeRemoved.hashCode; int valuesLength = this.values.length; int index = (hashCode& 0x7fffffff) % valuesLength; HashableWeakReference currentValue; while ((currentValue = this.values[index]) != null) { if (currentValue == toBeRemoved) { // replace the value at index with the last value with the same hash int sameHash = index; int current; while ((currentValue = this.values[current = (sameHash + 1) % valuesLength]) != null && currentValue.hashCode == hashCode) sameHash = current; this.values[index] = this.values[sameHash]; this.values[sameHash] = null; this.elementSize--; break; } if ( ++index == valuesLength) { index = 0; } } } } public boolean contains(Object obj) { return get(obj) != null; } /* * Return the object that is in this set and that is equals to the given object. * Return null if not found. */ public Object get(Object obj) { cleanupGarbageCollectedValues(); int valuesLength = this.values.length; int index = (obj.hashCode()& 0x7fffffff) % valuesLength; HashableWeakReference currentValue; while ((currentValue = this.values[index]) != null) { Object referent; if (obj.equals(referent = currentValue.get())) { return referent; } if ( ++index == valuesLength) { index = 0; } } return null; } private void rehash() { WeakHashSet newHashSet = new WeakHashSet(this.elementSize * 2); // double the number of expected elements newHashSet.referenceQueue = this.referenceQueue; HashableWeakReference currentValue; for (int i = 0, length = this.values.length; i < length; i++) if ((currentValue = this.values[i]) != null) newHashSet.addValue(currentValue); this.values = newHashSet.values; this.threshold = newHashSet.threshold; this.elementSize = newHashSet.elementSize; } |
| ||||
private void cleanupGarbageCollectedValues() { HashableWeakReference toBeRemoved; while ((toBeRemoved = (HashableWeakReference) this.referenceQueue.poll()) != null) { int hashCode = toBeRemoved.hashCode; int valuesLength = this.values.length; int index = (hashCode& 0x7fffffff) % valuesLength; HashableWeakReference currentValue; while ((currentValue = this.values[index]) != null) { if (currentValue == toBeRemoved) { // replace the value at index with the last value with the same hash int sameHash = index; int current; while ((currentValue = this.values[current = (sameHash + 1) % valuesLength]) != null && currentValue.hashCode == hashCode) sameHash = current; this.values[index] = this.values[sameHash]; this.values[sameHash] = null; this.elementSize--; break; } if ( ++index == valuesLength) { index = 0; } } } } public boolean contains(char[] array) { return get(array) != null; } /* * Return the char array that is in this set and that is equals to the given char array. * Return null if not found. */ public char[] get(char[] array) { cleanupGarbageCollectedValues(); int valuesLength = this.values.length; int index = (CharOperation.hashCode(array)& 0x7fffffff) % valuesLength; HashableWeakReference currentValue; while ((currentValue = this.values[index]) != null) { char[] referent; if (CharOperation.equals(array, referent = (char[]) currentValue.get())) { return referent; } if ( ++index == valuesLength) { index = 0; } } return null; } private void rehash() { WeakHashSetOfCharArray newHashSet = new WeakHashSetOfCharArray(this.elementSize * 2); // double the number of expected elements newHashSet.referenceQueue = this.referenceQueue; HashableWeakReference currentValue; for (int i = 0, length = this.values.length; i < length; i++) if ((currentValue = this.values[i]) != null) newHashSet.addValue(currentValue); this.values = newHashSet.values; this.threshold = newHashSet.threshold; this.elementSize = newHashSet.elementSize; } |
| |||
private void cleanupGarbageCollectedValues() { HashableWeakReference toBeRemoved; while ((toBeRemoved = (HashableWeakReference) this.referenceQueue.poll()) != null) { int hashCode = toBeRemoved.hashCode; int valuesLength = this.values.length; int index = (hashCode&0x7fffffff) % valuesLength; HashableWeakReference currentValue; while ((currentValue = this.values[index]) != null) { if (currentValue == toBeRemoved) { // replace the value at index with the last value with the same hash int sameHash = index; int current; while ((currentValue = this.values[current = (sameHash + 1) % valuesLength]) != null && currentValue.hashCode == hashCode) sameHash = current; this.values[index] = this.values[sameHash]; this.values[sameHash] = null; this.elementSize--; break; } if ( ++index == valuesLength) { index = 0; } } } } public boolean contains( [[#variable5a203760]] [[#variable5a203720]]) { return get( [[#variable5a203720]]) != null; } /* * Return the object that is in this set and that is equals to the given object. * Return null if not found. */ /* * Return the char array that is in this set and that is equals to the given char array. * Return null if not found. */ public [[#variable5a203760]] get( [[#variable5a203760]] [[#variable5a203720]]) { cleanupGarbageCollectedValues(); int valuesLength = this.values.length; int index = ( [[#variable5a203020]].hashCode [[#variable5a203640]]&0x7fffffff) % valuesLength; HashableWeakReference currentValue; while ((currentValue = this.values[index]) != null) { [[#variable5a203760]] referent; if ( [[#variable5a203020]].equals( [[#variable5a203480]])) { return referent; } if ( ++index == valuesLength) { index = 0; } } return null; } private void rehash() { [[#variable5a2034e0]] newHashSet = new [[#variable5a2034e0]](this.elementSize * 2); // double the number of expected elements newHashSet.referenceQueue = this.referenceQueue; HashableWeakReference currentValue; for (int i = 0, length = this.values.length; i < length; i++) if ((currentValue = this.values[i]) != null) newHashSet.addValue(currentValue); this.values = newHashSet.values; this.threshold = newHashSet.threshold; this.elementSize = newHashSet.elementSize; } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#5a203760]] | Object |
1 | 2 | [[#5a203760]] | char[] |
2 | 1 | [[#5a203720]] | obj |
2 | 2 | [[#5a203720]] | array |
3 | 1 | [[#5a203020]] | obj |
3 | 2 | [[#5a203020]] | CharOperation |
4 | 1 | [[#5a203640]] | () |
4 | 2 | [[#5a203640]] | (array) |
5 | 1 | [[#5a203480]] | referent = currentValue.get() |
5 | 2 | [[#5a203480]] | array, referent = (char[]) currentValue.get() |
6 | 1 | [[#5a2034e0]] | WeakHashSet |
6 | 2 | [[#5a2034e0]] | WeakHashSetOfCharArray |