for (int i = 1; i <= alphaSize; i++) {
int j = 0;
int k = i;
for (int parent_k; (parent_k = parent[k]) >= 0;) {
k = parent_k;
j++;
}
len[i - 1] = (char) j;
if (j > maxLen) {
tooLong = true;
}
}
for (int i = 1; i <= alphaSize; i++) {
int j = 0;
int k = i;
for (int parent_k; (parent_k = parent[k]) >= 0;) {
k = parent_k;
j++;
}
len[i - 1] = (byte) j;
if (j > maxLen) {
tooLong = true;
}
}
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 hbMakeCodeLengths(char[], int[], int, int)
|
|
Method name: void hbMakeCodeLengths(byte[], int[], Data, int, int)
|
Number of AST nodes: 9
|
|
Number of AST nodes: 9
|
|
1 | for (int i = 1; i <= alphaSize; i++) {↵ | | 1 | for (int i = 1; i <= alphaSize; i++) {↵
|
2 | int j = 0;↵ | | 2 | int j = 0;↵
|
3 | int k = i;↵ | | 3 | int k = i;↵
|
|
4 | for (int parent_k; (parent_k = parent[k]) >= 0;) {↵ | | 4 | for (int parent_k; (parent_k = parent[k]) >= 0;) {↵
|
5 | k = parent_k;↵ | | 5 | k = parent_k;↵
|
6 | j++;↵ | | 6 | j++;↵
|
7 | }↵ | | 7 | }↵
|
|
8 | len[i - 1] = (char) j;↵ | | 8 | len[i - 1] = (byte) j;↵
|
9 | if (j > maxLen) {↵ | | 9 | if (j > maxLen) {↵
|
10 | tooLong = true;↵ | | 10 | tooLong = true;↵
|
11 | }↵ | | 11 | }↵
|
12 | } | | 12 | }
|
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 | 49 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 8 |
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) | 1.9 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
74 | for (int i = 1; i <= alphaSize; i++) | | 74 | for (int i = 1; i <= alphaSize; i++) |
75 | | | 75 | |
76 | | | 76 | |
77 | for (int parent_k; (parent_k = parent[k]) >= 0; ) | | 77 | for (int parent_k; (parent_k = parent[k]) >= 0; ) |
78 | | | 78 | |
79 | | | 79 | |
| | | 80 | |
80 | | | | |
81 | | | 81 | |
82 | | | 82 | |
Precondition Violations (3)
Row |
Violation |
1 | Unmatched statement len[i - 1]=(byte)j; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement len[i - 1]=(char)j; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Clone fragment #1 returns variables tooLong, i, j , while Clone fragment #2 returns variables tooLong, i, j |