Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
38 | 2 | 4 | 0.991 | class_body_declarations[6] |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 38 | 18 | plugins/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/NameSet.java |
2 | 38 | 42 | plugins/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java |
| ||||
// to avoid using Enumerations, walk the individual values skipping nulls public char[][] names; public int elementSize; // number of elements in the table public int threshold; public NameSet(int size) { this.elementSize = 0; this.threshold = size; // size represents the expected number of elements int extraRoom = (int) (size * 1.5F); if (this.threshold == extraRoom) extraRoom++; this.names = new char[extraRoom][]; } public char[] add(char[] name) { int length = names.length; int index = CharOperation.hashCode(name) % length; char[] current; while ((current = names[index]) != null) { if (CharOperation.equals(current, name)) return current; if ( ++index == length)index = 0; } names[index] = name; // assumes the threshold is never equal to the size of the table if ( ++elementSize > threshold)rehash(); return name; } private void rehash() { NameSet newSet = new NameSet(elementSize * 2); // double the number of expected elements char[] current; for (int i = names.length; --i >= 0;) if ((current = names[i]) != null) newSet.add(current); this.names = newSet.names; this.elementSize = newSet.elementSize; this.threshold = newSet.threshold; } |
| ||||
public char[][] names; public int elementSize; // number of elements in the table public int threshold; PackageNameSet(int size) { this.elementSize = 0; this.threshold = size; // size represents the expected number of elements int extraRoom = (int) (size * 1.5F); if (this.threshold == extraRoom) extraRoom++; this.names = new char[extraRoom][]; } char[] add(char[] name) { int length = names.length; int index = CharOperation.hashCode(name) % length; char[] current; while ((current = names[index]) != null) { if (CharOperation.equals(current, name)) return current; if ( ++index == length)index = 0; } names[index] = name; // assumes the threshold is never equal to the size of the table if ( ++elementSize > threshold)rehash(); return name; } void rehash() { PackageNameSet newSet = new PackageNameSet(elementSize * 2); // double the number of expected elements char[] current; for (int i = names.length; --i >= 0;) if ((current = names[i]) != null) newSet.add(current); this.names = newSet.names; this.elementSize = newSet.elementSize; this.threshold = newSet.threshold; } |
| |||
// to avoid using Enumerations, walk the individual values skipping nulls public char[][] names; public int elementSize; // number of elements in the table public int threshold; [[#variablebe7a0320]] [[#variablebe7a0200]](int size) { this.elementSize = 0; this.threshold = size; // size represents the expected number of elements int extraRoom = (int) (size * 1.5F); if (this.threshold == extraRoom) extraRoom++; this.names = new char[extraRoom][]; } [[#variablebe7a02c0]]char[] add(char[] name) { int length = names.length; int index = CharOperation.hashCode(name) % length; char[] current; while ((current = names[index]) != null) { if (CharOperation.equals(current, name)) return current; if ( ++index == length) index = 0; } names[index] = name; // assumes the threshold is never equal to the size of the table if ( ++elementSize > threshold) rehash(); return name; } [[#variablebf947ee0]]void rehash() { [[#variablebe7a0200]] newSet = new [[#variablebe7a0200]](elementSize * 2); // double the number of expected elements char[] current; for (int i = names.length; --i >= 0;) if ((current = names[i]) != null) newSet.add(current); this.names = newSet.names; this.elementSize = newSet.elementSize; this.threshold = newSet.threshold; } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#be7a0320]] | public |
1 | 2 | [[#be7a0320]] | |
2 | 1 | [[#be7a0200]] | NameSet |
2 | 2 | [[#be7a0200]] | PackageNameSet |
3 | 1 | [[#be7a02c0]] | public |
3 | 2 | [[#be7a02c0]] | |
4 | 1 | [[#bf947ee0]] | private |
4 | 2 | [[#bf947ee0]] |