if (zPend > 0) {
zPend--;
while (true) {
if ((zPend & 1) == 0) {
sfmap[wr] = RUNA;
wr++;
mtfFreq[RUNA]++;
} else {
sfmap[wr] = RUNB;
wr++;
mtfFreq[RUNB]++;
}
if (zPend >= 2) {
zPend = (zPend - 2) >> 1;
} else {
break;
}
}
zPend = 0;
}
if (zPend > 0) {
zPend--;
while (true) {
if ((zPend & 1) == 0) {
sfmap[wr] = RUNA;
wr++;
mtfFreq[RUNA]++;
} else {
sfmap[wr] = RUNB;
wr++;
mtfFreq[RUNB]++;
}
if (zPend >= 2) {
zPend = (zPend - 2) >> 1;
} else {
break;
}
}
}
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/bzip2/CBZip2OutputStream.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/bzip2/CBZip2OutputStream.java
|
Method name: void generateMTFValues()
|
|
Method name: void generateMTFValues()
|
Number of AST nodes: 14
|
|
Number of AST nodes: 13
|
|
1 | if (zPend > 0) {↵ | | 1 | if (zPend > 0) {↵
|
2 | zPend--;↵ | | 2 | zPend--;↵
|
3 | while (true) {↵ | | 3 | while (true) {↵
|
4 | if ((zPend & 1) == 0) {↵ | | 4 | if ((zPend & 1) == 0) {↵
|
5 | sfmap[wr] = RUNA;↵ | | 5 | sfmap[wr] = RUNA;↵
|
6 | wr++;↵ | | 6 | wr++;↵
|
7 | mtfFreq[RUNA]++;↵ | | 7 | mtfFreq[RUNA]++;↵
|
8 | } else {↵ | | 8 | } else {↵
|
9 | sfmap[wr] = RUNB;↵ | | 9 | sfmap[wr] = RUNB;↵
|
10 | wr++;↵ | | 10 | ↵
|
11 | ↵ | | 11 | wr++;↵
|
12 | mtfFreq[RUNB]++;↵ | | 12 | mtfFreq[RUNB]++;↵
|
13 | }↵ | | 13 | }↵
|
|
14 | if (zPend >= 2) {↵ | | 14 | if (zPend >= 2) {↵
|
15 | zPend = (zPend - 2) >> 1;↵ | | 15 | zPend = (zPend - 2) >> 1;↵
|
16 | } else {↵ | | 16 | } else {↵
|
17 | break;↵ | | 17 | break;↵
|
18 | ↵ | | 18 | }↵
|
19 | }↵ | | 19 | }↵
|
20 | }↵ | | |
|
21 | zPend = 0;↵ | | |
|
22 | } | | 20 | }
|
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.6 |
Clones location | Clones are in the same method |
Number of node comparisons | 95 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 13 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 4.2 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
35 | if (zPend > 0) | | 52 | if (zPend > 0) |
36 | | | 53 | |
37 | | | 54 | |
38 | | | 55 | |
39 | | | 56 | |
40 | | | 57 | |
41 | | | 58 | |
| | | | |
42 | | | 59 | |
43 | | | 60 | |
44 | | | 61 | |
45 | | | 62 | |
46 | zPend = (zPend - 2) >> 1; | | 63 | zPend = (zPend - 2) >> 1; |
| | | | |
47 | | | 64 | |
48 | | | | |
Precondition Violations (2)
Row |
Violation |
1 | Unmatched statement zPend=0; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Clone fragment #1 returns variables wr, mtfFreq , while Clone fragment #2 returns variables wr, mtfFreq |