File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java | |||
Method name: String substitute(String, String, int)
|
Method name: String substitute(String, String, int)
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | if (++i < argument.length()) {↵ | 1 | if (++i < argument.length()) {↵ | |
2 | c = argument.charAt(i);↵ | 2 | c = argument.charAt(i);↵ | |
3 | int value = Character.digit(c, 10);↵ | 3 | int value = Character.digit(c, 10);↵ | |
4 | if (value > -1) {↵ | 4 | if (value > -1) {↵ | |
5 | result.append((String) v.elementAt(value));↵ | 5 | subst.append("$").append(value);↵ | |
6 | } else {↵ | 6 | } else {↵ | |
7 | result.append(c);↵ | 7 | subst.append(c);↵ | |
8 | }↵ | 8 | }↵ | |
9 | } else {↵ | 9 | } else {↵ | |
10 | // XXX - should throw an exception instead?↵ | 10 | // XXX - should throw an exception instead?↵ | |
11 | result.append('\\');↵ | 11 | subst.append('\\');↵ | |
12 | } | 12 |
| |
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.4 |
Clones location | Clones are in different classes |
Number of node comparisons | 27 |
Number of mapped statements | 6 |
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) | 3.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6 | if (++i < argument.length()) | 8 | if (++i < argument.length()) | |||||||||||
7 | c = argument.charAt(i); | 9 | c = argument.charAt(i); | |||||||||||
8 | int value = Character.digit(c, 10); | 10 | int value = Character.digit(c, 10); | |||||||||||
9 | if (value > -1) | 11 | if (value > -1) | |||||||||||
10 | result.append((String)v.elementAt(value)); |
| | |||||||||||
|
| 12 | subst.append("$").append(value); | |||||||||||
else | else | |||||||||||||
11 | result.append(c); |
| 13 | subst.append(c); | ||||||||||
else | else | |||||||||||||
12 | result.append('\\'); |
| 14 | subst.append('\\'); |
Row | Violation |
---|---|
1 | Unmatched statement result.append((String)v.elementAt(value)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement subst.append("$").append(value); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Clone fragment #1 returns variables i, value , while Clone fragment #2 returns variables i, value |