/**
* Creates a new HashTree and adds all the objects in the given collection
* as top-level nodes in the tree.
*
* @param keys
* a collection of objects to be added to the created HashTree.
*/
public HashTree(Collection<?> keys) {
data = new HashMap<Object, HashTree>();
for (Object o : keys) {
data.put(o, new HashTree());
}
}
/**
* Creates a new HashTree and adds all the objects in the given array as
* top-level nodes in the tree.
*/
public HashTree(Object[] keys) {
data = new HashMap<Object, HashTree>();
for (int x = 0; x < keys.length; x++) {
data.put(keys[x], new HashTree());
}
}
Clone fragments detected by clone detection tool
File path: /apache-jmeter-2.11/src/jorphan/org/apache/jorphan/collections/HashTree.java
|
|
File path: /apache-jmeter-2.11/src/jorphan/org/apache/jorphan/collections/HashTree.java
|
Method name: void HashTree(Collection>)
|
|
Method name: void HashTree(Object[])
|
Number of AST nodes: 2
|
|
Number of AST nodes: 2
|
|
1 | /**
| | 1 | /**
|
2 | * Creates a new HashTree and adds all the objects in the given collection
| | 2 | * Creates a new HashTree and adds all the objects in the given array as
|
3 | * as top-level nodes in the tree.
| | 3 | * top-level nodes in the tree.
|
4 | *
| | 4 | */
|
5 | * @param keys
| | 5 | public HashTree(Object[] keys) {
|
6 | * a collection of objects to be added to the created HashTree.
| | 6 | data = new HashMap<Object, HashTree>();
|
7 | */
| | 7 | for (int x = 0; x < keys.length; x++) {
|
8 | public HashTree(Collection<?> keys) {
| | 8 | data.put(keys[x], new HashTree());
|
9 | data = new HashMap<Object, HashTree>();
| | 9 | }
|
10 | for (Object o : keys) {
| | 10 | } |
11 | data.put(o, new HashTree());
| | | |
12 | }
| | | |
13 | } | | | |
See real code fragment |
|
See real code fragment |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
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) | 0.0 |
Similarity Score | 0.500 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
2 | for (Object o : keys) | | 2 | for (int x = 0; x < keys.length; x++) |
3 | data.put(o, new HashTree()); | | 3 | data.put(keys[x], new HashTree()); |
Precondition Violations (4)
Row |
Violation |
1 | Type java.util.Collection<> of variable keys does not match with type java.lang.Object[] of variable keys |
2 | Type java.util.Collection<> of variable keys does not match with type java.lang.Object[] of variable keys |
3 | Expression o cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression keys[x] cannot be parameterized, because it has dependencies to/from statements that will be extracted |