line = linebuf.toString();
res = doReplace(regex, subs, line, options);
if (!res.equals(line)) {
changes = true;
}
pw.print(res);
if (hasCR) {
pw.print('\r');
hasCR = false;
}
line = linebuf.toString();
res = doReplace(regex, subs, line, options);
if (!res.equals(line)) {
changes = true;
}
pw.print(res);
if (hasCR) {
pw.print('\r');
hasCR = false;
}
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
|
Method name: void doReplace(File, int)
|
|
Method name: void doReplace(File, int)
|
Number of AST nodes: 8
|
|
Number of AST nodes: 8
|
|
1 | line = linebuf.toString();↵ | | 1 | line = linebuf.toString();↵
|
2 | res = doReplace(regex, subs, line, options);↵ | | 2 | res = doReplace(regex, subs, line, options);↵
|
|
3 | if (!res.equals(line)) {↵ | | 3 | if (!res.equals(line)) {↵
|
4 | changes = true;↵ | | 4 | changes = true;↵
|
5 | }↵ | | 5 | }↵
|
|
6 | pw.print(res);↵ | | 6 | pw.print(res);↵
|
7 | if (hasCR) {↵ | | 7 | if (hasCR) {↵
|
8 | pw.print('\r');↵ | | 8 | pw.print('\r');↵
|
9 | hasCR = false;↵ | | 9 | hasCR = false;↵
|
10 | } | | 10 | }
|
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.4 |
Clones location | Clones are in the same method |
Number of node comparisons | 31 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 8 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 8.0 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
34 | line = linebuf.toString(); | | 45 | line = linebuf.toString(); |
35 | res = doReplace(regex, subs, line, options); | | 46 | res = doReplace(regex, subs, line, options); |
36 | if (!res.equals(line)) | | 47 | if (!res.equals(line)) |
37 | | | 48 | |
38 | pw.print(res); | | 49 | pw.print(res); |
39 | if (hasCR) | | 50 | if (hasCR) |
40 | | | 51 | |
41 | | | 52 | |
Precondition Violations (1)
Row |
Violation |
1 | Clone fragment #1 returns variables hasCR, changes , while Clone fragment #2 returns variables hasCR, changes |