Entry tab[] = table;
int hash = key;
int index = (hash & 0x7FFFFFFF) % tab.length;
for(Entry e = tab[index]; e != null; e = e.next) {
if (e.hash == hash) {
return e;
}
}
return null;
Entry tab[] = table;
int hash = key;
int index = (hash & 0x7FFFFFFF) % tab.length;
for (Entry e = tab[index]; e != null; e = e.next) {
if (e.hash == hash) {
return true;
}
}
return false;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/util/collections/IntHashMap.java
|
|
File path: /jruby-1.4.0/src/org/jruby/util/collections/IntHashMap.java
|
Method name: Entry getEntry(int)
|
|
Method name: boolean containsKey(int)
|
Number of AST nodes: 7
|
|
Number of AST nodes: 7
|
|
1 | Entry tab[] = table;↵ | | 1 | Entry tab[] = table;↵
|
2 | int hash = key;↵ | | 2 | int hash = key;↵
|
3 | int index = (hash & 0x7FFFFFFF) % tab.length;↵ | | 3 | int index = (hash & 0x7FFFFFFF) % tab.length;↵
|
4 | for(Entry e = tab[index]; e != null; e = e.next) {↵ | | 4 | for (Entry e = tab[index]; e != null; e = e.next) {↵
|
5 | if (e.hash == hash) {↵ | | 5 | if (e.hash == hash) {↵
|
6 | return e;↵ | | 6 | return true;↵
|
7 | }↵ | | 7 | }↵
|
8 | }↵ | | 8 | }↵
|
9 | return null; | | 9 | return false;
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 21 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 1.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | Entry tab[] = table; | | 1 | Entry tab[] = table; |
2 | int hash = key; | | 2 | int hash = key; |
3 | int index = (hash & 0x7FFFFFFF) % tab.length; | | 3 | int index = (hash & 0x7FFFFFFF) % tab.length; |
4 | for (Entry e = tab[index]; e != null; e = e.next) | | 4 | for (Entry e = tab[index]; e != null; e = e.next) |
5 | | | 5 | |
| | | 6 | |
6 | | | | |
| | | 7 | return false; |
7 | return null; | | | |
Precondition Violations (6)
Row |
Violation |
1 | Unmatched return true; |
2 | Unmatched statement return e; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched return e; |
4 | Unmatched return false; |
5 | Unmatched return null; |
6 | Clone fragment #1 returns variables e , while Clone fragment #2 returns variables |