for (int i = 0; i < cnt; i++) {
String match = reg.getParen(i);
// treat non-matching groups as empty matches
if (match == null) {
match = "";
}
v.addElement(match);
}
for (int i = 0; i < cnt; i++) {
String match = mr.group(i);
// treat non-matching groups as empty matches
if (match == null) {
match = "";
}
v.addElement(match);
}
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/JakartaRegexpMatcher.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/JakartaOroMatcher.java
|
Method name: Vector getGroups(String, int)
|
|
Method name: Vector getGroups(String, int)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | for (int i = 0; i < cnt; i++) {↵ | | 1 | for (int i = 0; i < cnt; i++) {↵
|
2 | String match = reg.getParen(i);↵ | | 2 | String match = mr.group(i);↵
|
3 | // treat non-matching groups as empty matches↵ | | 3 | // treat non-matching groups as empty matches↵
|
4 | if (match == null) {↵ | | 4 | if (match == null) {↵
|
5 | match = "";↵ | | 5 | match = "";↵
|
6 | }↵ | | 6 | }↵
|
7 | v.addElement(match);↵ | | 7 | v.addElement(match);↵
|
8 | } | | 8 | }
|
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 |
Number of node comparisons | 13 |
-
{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 | 1 |
Time elapsed for statement mapping (ms) | 0.6 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
6 | for (int i = 0; i < cnt; i++) | | 6 | for (int i = 0; i < cnt; i++) |
| | | 7 | String match = mr.group(i); |
7 | String match = reg.getParen(i); | | | |
8 | | | 8 | |
9 | | | 9 | |
10 | | | 10 | |
Precondition Violations (2)
Row |
Violation |
1 | Unmatched statement String match=mr.group(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement String match=reg.getParen(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |