Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
102 | 2 | 4 | 0.979 | class_body_declarations[7] |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 102 | 44 | plugins/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfIntValues.java |
2 | 102 | 50 | plugins/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObject.java |
| ||||
public Object clone() throws CloneNotSupportedException { HashtableOfIntValues result = (HashtableOfIntValues) super.clone(); result.elementSize = this.elementSize; result.threshold = this.threshold; int length = this.keyTable.length; result.keyTable = new char[length][]; System.arraycopy(this.keyTable, 0, result.keyTable, 0, length); length = this.valueTable.length; result.valueTable = new int[length]; System.arraycopy(this.valueTable, 0, result.valueTable, 0, length); return result; } public boolean containsKey(char[] key) { int length = keyTable.length, index = CharOperation.hashCode(key) % length; int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) return true; if ( ++index == length) { index = 0; } } return false; } public int get(char[] key) { int length = keyTable.length, index = CharOperation.hashCode(key) % length; int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) return valueTable[index]; if ( ++index == length) { index = 0; } } return NO_VALUE; } public int put(char[] key, int value) { int length = keyTable.length, index = CharOperation.hashCode(key) % length; int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) return valueTable[index] = value; if ( ++index == length) { index = 0; } } keyTable[index] = key; valueTable[index] = value; // assumes the threshold is never equal to the size of the table if ( ++elementSize > threshold) rehash(); return value; } public int removeKey(char[] key) { int length = keyTable.length, index = CharOperation.hashCode(key) % length; int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) { int value = valueTable[index]; elementSize--; keyTable[index] = null; valueTable[index] = NO_VALUE; rehash(); return value; } if ( ++index == length) { index = 0; } } return NO_VALUE; } private void rehash() { HashtableOfIntValues newHashtable = new HashtableOfIntValues(elementSize * 2); // double the number of expected elements char[] currentKey; for (int i = keyTable.length; --i >= 0;) if ((currentKey = keyTable[i]) != null) newHashtable.put(currentKey, valueTable[i]); this.keyTable = newHashtable.keyTable; this.valueTable = newHashtable.valueTable; this.threshold = newHashtable.threshold; } public int size() { return elementSize; } |
| ||||
public Object clone() throws CloneNotSupportedException { HashtableOfObject result = (HashtableOfObject) super.clone(); result.elementSize = this.elementSize; result.threshold = this.threshold; int length = this.keyTable.length; result.keyTable = new char[length][]; System.arraycopy(this.keyTable, 0, result.keyTable, 0, length); length = this.valueTable.length; result.valueTable = new Object[length]; System.arraycopy(this.valueTable, 0, result.valueTable, 0, length); return result; } public boolean containsKey(char[] key) { int length = keyTable.length, index = CharOperation.hashCode(key) % length; int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) return true; if ( ++index == length) { index = 0; } } return false; } public Object get(char[] key) { int length = keyTable.length, index = CharOperation.hashCode(key) % length; int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) return valueTable[index]; if ( ++index == length) { index = 0; } } return null; } public Object put(char[] key, Object value) { int length = keyTable.length, index = CharOperation.hashCode(key) % length; int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) return valueTable[index] = value; if ( ++index == length) { index = 0; } } keyTable[index] = key; valueTable[index] = value; // assumes the threshold is never equal to the size of the table if ( ++elementSize > threshold) rehash(); return value; } public Object removeKey(char[] key) { int length = keyTable.length, index = CharOperation.hashCode(key) % length; int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) { Object value = valueTable[index]; elementSize--; keyTable[index] = null; valueTable[index] = null; rehash(); return value; } if ( ++index == length) { index = 0; } } return null; } private void rehash() { HashtableOfObject newHashtable = new HashtableOfObject(elementSize * 2); // double the number of expected elements char[] currentKey; for (int i = keyTable.length; --i >= 0;) if ((currentKey = keyTable[i]) != null) newHashtable.put(currentKey, valueTable[i]); this.keyTable = newHashtable.keyTable; this.valueTable = newHashtable.valueTable; this.threshold = newHashtable.threshold; } public int size() { return elementSize; } |
| |||
public Object clone() throws CloneNotSupportedException { [[#variableb9268960]] result = ( [[#variableb9268960]]) super.clone(); result.elementSize = this.elementSize; result.threshold = this.threshold; int length = this.keyTable.length; result.keyTable = new char[length][]; System.arraycopy(this.keyTable, 0, result.keyTable, 0, length); length = this.valueTable.length; result.valueTable = [[#variableb91b77e0]]; System.arraycopy(this.valueTable, 0, result.valueTable, 0, length); return result; } public boolean containsKey(char[] key) { int length = keyTable.length, index = CharOperation.hashCode(key) % length; int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) return true; if ( ++index == length) { index = 0; } } return false; } public [[#variablebb139960]] get(char[] key) { int length = keyTable.length, index = CharOperation.hashCode(key) % length; int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) return valueTable[index]; if ( ++index == length) { index = 0; } } return [[#variablebb139b00]]; } public [[#variablebb139960]] put(char[] key, [[#variablebb139960]] value) { int length = keyTable.length, index = CharOperation.hashCode(key) % length; int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) return valueTable[index] = value; if ( ++index == length) { index = 0; } } keyTable[index] = key; valueTable[index] = value; // assumes the threshold is never equal to the size of the table if ( ++elementSize > threshold) rehash(); return value; } public [[#variablebb139960]] removeKey(char[] key) { int length = keyTable.length, index = CharOperation.hashCode(key) % length; int keyLength = key.length; char[] currentKey; while ((currentKey = keyTable[index]) != null) { if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) { [[#variablebb139960]] value = valueTable[index]; elementSize--; keyTable[index] = null; valueTable[index] = [[#variablebb139b00]]; rehash(); return value; } if ( ++index == length) { index = 0; } } return [[#variablebb139b00]]; } private void rehash() { [[#variableb9268960]] newHashtable = new [[#variableb9268960]](elementSize * 2); // double the number of expected elements char[] currentKey; for (int i = keyTable.length; --i >= 0;) if ((currentKey = keyTable[i]) != null) newHashtable.put(currentKey, valueTable[i]); this.keyTable = newHashtable.keyTable; this.valueTable = newHashtable.valueTable; this.threshold = newHashtable.threshold; } public int size() { return elementSize; } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#b9268960]] | HashtableOfIntValues |
1 | 2 | [[#b9268960]] | HashtableOfObject |
2 | 1 | [[#b91b77e0]] | new int[length] |
2 | 2 | [[#b91b77e0]] | new Object[length] |
3 | 1 | [[#bb139960]] | int |
3 | 2 | [[#bb139960]] | Object |
4 | 1 | [[#bb139b00]] | NO_VALUE |
4 | 2 | [[#bb139b00]] | null |