File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/XmlProperty.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java | |||
Method name: void addNodeRecursively(Node, String, Object)
|
Method name: NodeList listChildNodes(Node, NodeFilter, boolean)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 4 | |||
1 | if (node.hasChildNodes()) {↵ | |||
2 | NodeList nodeChildren = node.getChildNodes();↵ | |||
1 | NodeList recmatches = listChildNodes(child, filter, recurse);↵ | |||
3 | int numChildren = nodeChildren.getLength();↵ | 2 | final int reclength = recmatches.getLength();↵ | |
4 | for (int i = 0; i < numChildren; i++) {↵ | 3 | for (int j = 0; j < reclength; j++) {↵ | |
5 | // For each child, pass the object added by↵ | 4 | ↵ | |
6 | // processNode to its children -- in other word, each↵ | |||
7 | // object can pass information along to its children.↵ | |||
8 | addNodeRecursively(nodeChildren.item(i), nodePrefix,↵ | |||
9 | nodeObject);↵ | 5 | matches.addElement(recmatches.item(i));↵ | |
10 | }↵ | 6 | ↵ | |
11 | } | 7 |
| |
See real code fragment | See real code fragment |
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.1 |
Clones location | Clones are in different classes |
Number of node comparisons | 9 |
Number of mapped statements | 3 |
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.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8 | NodeList nodeChildren = node.getChildNodes(); |
| 10 | NodeList recmatches = listChildNodes(child, filter, recurse); | ||||||||||||||||||||||||
9 | int numChildren = nodeChildren.getLength(); |
| | |||||||||||||||||||||||||
|
| 11 | final int reclength = recmatches.getLength(); | |||||||||||||||||||||||||
10 | for (int i = 0; i < numChildren; i++) |
| 12 | for (int j = 0; j < reclength; j++) | ||||||||||||||||||||||||
11 | addNodeRecursively(nodeChildren.item(i), nodePrefix, nodeObject); |
| 13 | matches.addElement(recmatches.item(i)); |
Row | Violation |
---|---|
1 | Unmatched statement int numChildren=nodeChildren.getLength(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement final int reclength=recmatches.getLength(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Expression addNodeRecursively(nodeChildren.item(i),nodePrefix,nodeObject) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression matches.addElement(recmatches.item(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression addNodeRecursively(nodeChildren.item(i),nodePrefix,nodeObject) is a void method call, and thus it cannot be parameterized |
6 | Expression matches.addElement(recmatches.item(i)) is a void method call, and thus it cannot be parameterized |
7 | Expression addNodeRecursively(nodeChildren.item(i),nodePrefix,nodeObject) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression matches.addElement(recmatches.item(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression addNodeRecursively(nodeChildren.item(i),nodePrefix,nodeObject) is a void method call, and thus it cannot be parameterized |
10 | Expression matches.addElement(recmatches.item(i)) is a void method call, and thus it cannot be parameterized |