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: 9 | Number of AST nodes: 9 | |||
1 | if (c == '\\') {↵ | 1 | if (c == '\\') {↵ | |
2 | if (++i < argument.length()) {↵ | 2 | if (++i < argument.length()) {↵ | |
3 | c = argument.charAt(i);↵ | 3 | c = argument.charAt(i);↵ | |
4 | int value = Character.digit(c, 10);↵ | 4 | int value = Character.digit(c, 10);↵ | |
5 | if (value > -1) {↵ | 5 | if (value > -1) {↵ | |
6 | result.append((String) v.elementAt(value));↵ | 6 | subst.append("$").append(value);↵ | |
7 | } else {↵ | 7 | } else {↵ | |
8 | result.append(c);↵ | 8 | subst.append(c);↵ | |
9 | }↵ | 9 | }↵ | |
10 | } else {↵ | 10 | } else {↵ | |
11 | // XXX - should throw an exception instead?↵ | 11 | // XXX - should throw an exception instead?↵ | |
12 | result.append('\\');↵ | 12 | subst.append('\\');↵ | |
13 | }↵ | 13 | }↵ | |
14 | } else {↵ | 14 | } else {↵ | |
15 | result.append(c);↵ | 15 | subst.append(c);↵ | |
16 | } | 16 |
| |
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 | 30 |
Number of mapped statements | 8 |
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.9 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5 | if (c == '\\') | 7 | if (c == '\\') | |||||||||||
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('\\'); | ||||||||||
else | else | |||||||||||||
13 | result.append(c); |
| 15 | subst.append(c); |
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 |