if (!data.containsKey(key)) {
HashTree newTree = createNewTree();
data.put(key, newTree);
order.add(key);
return newTree;
}
if (!data.containsKey(key)) {
HashTree newTree = createNewTree();
data.put(key, newTree);
return newTree;
}
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jorphan/collections/ListedHashTree.java
|
|
File path: /jakarta-jmeter-2.3.2/src/org/apache/jorphan/collections/HashTree.java
|
Method name: HashTree add(Object)
|
|
Method name: HashTree add(Object)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 4
|
|
1 | if (!data.containsKey(key)) {↵ | | 1 | if (!data.containsKey(key)) {↵
|
2 | HashTree newTree = createNewTree();↵ | | 2 | HashTree newTree = createNewTree();↵
|
3 | data.put(key, newTree);↵ | | 3 | data.put(key, newTree);↵
|
4 | order.add(key);↵ | | 4 | ↵
|
5 | return newTree;↵ | | 5 | return newTree;↵
|
6 | } | | 6 | }
|
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.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 20 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 4 |
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) | 1.3 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (!data.containsKey(key)) | | 1 | if (!data.containsKey(key)) |
2 | HashTree newTree = createNewTree(); | | 2 | HashTree newTree = createNewTree(); |
3 | | | 3 | |
4 | | | | |
5 | | | 4 | |
Precondition Violations (2)
Row |
Violation |
1 | Unmatched statement order.add(key); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Not all possible execution flows end in a return statement |