for (int i = 1; i <= alphaSize; i++) {
parent[i] = -1;
nHeap++;
heap[nHeap] = i;
int zz = nHeap;
int tmp = heap[zz];
while (weight[tmp] < weight[heap[zz >> 1]]) {
heap[zz] = heap[zz >> 1];
zz >>= 1;
}
heap[zz] = tmp;
}
for (int i = 1; i <= alphaSize; i++) {
parent[i] = -1;
nHeap++;
heap[nHeap] = i;
int zz = nHeap;
int tmp = heap[zz];
while (weight[tmp] < weight[heap[zz >> 1]]) {
heap[zz] = heap[zz >> 1];
zz >>= 1;
}
heap[zz] = tmp;
}
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: 10
|
|
Number of AST nodes: 10
|
|
1 | for (int i = 1; i <= alphaSize; i++) {↵ | | 1 | for (int i = 1; i <= alphaSize; i++) {↵
|
2 | parent[i] = -1;↵ | | 2 | parent[i] = -1;↵
|
3 | nHeap++;↵ | | 3 | nHeap++;↵
|
4 | heap[nHeap] = i;↵ | | 4 | heap[nHeap] = i;↵
|
|
5 | int zz = nHeap;↵ | | 5 | int zz = nHeap;↵
|
6 | int tmp = heap[zz];↵ | | 6 | int tmp = heap[zz];↵
|
7 | while (weight[tmp] < weight[heap[zz >> 1]]) {↵ | | 7 | while (weight[tmp] < weight[heap[zz >> 1]]) {↵
|
8 | heap[zz] = heap[zz >> 1];↵ | | 8 | heap[zz] = heap[zz >> 1];↵
|
9 | zz >>= 1;↵ | | 9 | zz >>= 1;↵
|
10 | }↵ | | 10 | }↵
|
11 | heap[zz] = tmp;↵ | | 11 | heap[zz] = tmp;↵
|
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.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 67 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 10 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 2.7 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
13 | for (int i = 1; i <= alphaSize; i++) | | 13 | for (int i = 1; i <= alphaSize; i++) |
14 | | | 14 | |
15 | | | 15 | |
16 | | | 16 | |
17 | | | 17 | |
18 | | | 18 | |
19 | while (weight[tmp] < weight[heap[zz >> 1]]) | | 19 | while (weight[tmp] < weight[heap[zz >> 1]]) |
20 | heap[zz] = heap[zz >> 1]; | | 20 | heap[zz] = heap[zz >> 1]; |
21 | | | 21 | |
22 | | | 22 | |
Precondition Violations (1)
Row |
Violation |
1 | Clone fragment #1 returns variables nHeap, heap, parent , while Clone fragment #2 returns variables nHeap, heap, parent |