File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/JakartaOroMatcher.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/JakartaRegexpMatcher.java | |||
Method name: Vector getGroups(String, int)
|
Method name: Vector getGroups(String, int)
|
|||
Number of AST nodes: 11 | Number of AST nodes: 11 | |||
1 | RE reg = getCompiledPattern(options);↵ | |||
1 | if (!matches(input, options)) {↵ | 2 | if (!matches(input, reg)) {↵ | |
2 | return null;↵ | 3 | return null;↵ | |
3 | }↵ | 4 | }↵ | |
4 | Vector v = new Vector();↵ | 5 | Vector v = new Vector();↵ | |
5 | MatchResult mr = matcher.getMatch();↵ | 6 | ↵ | |
6 | int cnt = mr.groups();↵ | 7 | int cnt = reg.getParenCount();↵ | |
7 | for (int i = 0; i < cnt; i++) {↵ | 8 | for (int i = 0; i < cnt; i++) {↵ | |
8 | String match = mr.group(i);↵ | 9 | String match = reg.getParen(i);↵ | |
9 | // treat non-matching groups as empty matches↵ | 10 | // treat non-matching groups as empty matches↵ | |
10 | if (match == null) {↵ | 11 | if (match == null) {↵ | |
11 | match = "";↵ | 12 | match = "";↵ | |
12 | }↵ | 13 | }↵ | |
13 | v.addElement(match);↵ | 14 | v.addElement(match);↵ | |
14 | }↵ | 15 | }↵ | |
15 | return v; | 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.3 |
Clones location | Clones are in different classes |
Number of node comparisons | 27 |
Number of mapped statements | 8 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 1.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | RE reg = getCompiledPattern(options); | ||||||||||||||||
1 | if (!matches(input, options)) |
| 2 | if (!matches(input, reg)) | ||||||||||||||
2 | return null; | 3 | return null; | |||||||||||||||
3 | Vector v = new Vector(); | 4 | Vector v = new Vector(); | |||||||||||||||
4 | MatchResult mr = matcher.getMatch(); | | ||||||||||||||||
| 5 | int cnt = reg.getParenCount(); | ||||||||||||||||
5 | int cnt = mr.groups(); | | ||||||||||||||||
6 | for (int i = 0; i < cnt; i++) | 6 | for (int i = 0; i < cnt; i++) | |||||||||||||||
|
| 7 | String match = reg.getParen(i); | |||||||||||||||
7 | String match = mr.group(i); |
| | |||||||||||||||
8 | if (match == null) | 8 | if (match == null) | |||||||||||||||
9 | match = ""; | 9 | match = ""; | |||||||||||||||
10 | v.addElement(match); | 10 | v.addElement(match); | |||||||||||||||
11 | return v; | 11 | return v; |
Row | Violation |
---|---|
1 | Type int of variable options does not match with type org.apache.regexp.RE of variable reg |
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 |
3 | 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 |