for (int i = 0; i < length; ++i)
{
if (oldContentBuffer[i] != newContentBuffer[i])
{
equal = false;
break;
}
}
for (int i = 0; i < oldLength; ++i)
{
if (oldContentBuffer[i] != newContentBuffer[i])
{
equal = false;
break LOOP;
}
}
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/resource/impl/ResourceImpl.java
|
|
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/resource/impl/ResourceImpl.java
|
Method name: void saveOnlyIfChangedWithMemoryBuffer(Map,?>)
|
|
Method name: void saveOnlyIfChangedWithFileBuffer(Map,?>)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | for (int i = 0; i < length; ++i)↵ | | 1 | for (int i = 0; i < oldLength; ++i)↵
|
2 | {↵ | | 2 | ↵
|
| | | 3 | {↵
|
3 | if (oldContentBuffer[i] != newContentBuffer[i])↵ | | 4 | if (oldContentBuffer[i] != newContentBuffer[i])↵
|
4 | {↵ | | 5 | ↵
|
| | | 6 | {↵
|
5 | equal = false;↵ | | 7 | equal = false;↵
|
6 | break;↵ | | 8 | break↵
|
| | | 9 | LOOP;↵
|
7 | }↵ | | 10 | }↵
|
8 | } | | 11 | }
|
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 12 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.5 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
15 | for (int i = 0; i < length; ++i) | | 19 | for (int i = 0; i < oldLength; ++i) |
16 | if (oldContentBuffer[i] != newContentBuffer[i]) | | 20 | if (oldContentBuffer[i] != newContentBuffer[i]) |
17 | | | 21 | |
18 | | | | |
| | | 22 | |
Precondition Violations (3)
Row |
Violation |
1 | Unmatched break; |
2 | Unmatched break LOOP; |
3 | Clone fragment #1 returns variables equal , while Clone fragment #2 returns variables |