int s2 = withLinkMatcher.start();
int e2 = withLinkMatcher.end();
if ((s2 < s1) && (e2 > e1)) {
// same email adress - just append and continue
buf.append(s.substring(pos, e2));
pos = e2;
insertLink = false; // already handled
} else {
// not the same
insertLink = true;
}
int s2 = withLinkMatcher.start();
int e2 = withLinkMatcher.end();
if ((s2 < s1) && (e2 > e1)) {
// same url - just append and continue
buf.append(s.substring(pos, e2));
pos = e2;
insertLink = false; // already handled
} else {
// not the same
insertLink = true;
}
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/parser/text/HtmlParser.java
|
|
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/parser/text/HtmlParser.java
|
Method name: String substituteEmailAddress(String, boolean)
|
|
Method name: String substituteURL(String, boolean)
|
Number of AST nodes: 7
|
|
Number of AST nodes: 7
|
|
1 | int s2 = withLinkMatcher.start();↵ | | 1 | int s2 = withLinkMatcher.start();↵
|
2 | int e2 = withLinkMatcher.end();↵ | | 2 | int e2 = withLinkMatcher.end();↵
|
3 | ↵ | | |
|
4 | if ((s2 < s1) && (e2 > e1)) {↵ | | 3 | if ((s2 < s1) && (e2 > e1)) {↵
|
5 | // same email adress - just append and continue↵ | | 4 | // same url - just append and continue↵
|
6 | buf.append(s.substring(pos, e2));↵ | | 5 | buf.append(s.substring(pos, e2));↵
|
7 | pos = e2;↵ | | 6 | pos = e2;↵
|
8 | insertLink = false; // already handled↵ | | 7 | insertLink = false; // already handled↵
|
9 | } else {↵ | | 8 | } else {↵
|
10 | // not the same↵ | | 9 | // not the same↵
|
11 | insertLink = true;↵ | | 10 | insertLink = true;↵
|
12 | } | | 11 | }
|
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 31 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 7 |
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) | 5.4 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
14 | int s2 = withLinkMatcher.start(); | | 14 | int s2 = withLinkMatcher.start(); |
15 | int e2 = withLinkMatcher.end(); | | 15 | int e2 = withLinkMatcher.end(); |
16 | if ((s2 < s1) && (e2 > e1)) | | 16 | if ((s2 < s1) && (e2 > e1)) |
17 | buf.append(s.substring(pos, e2)); | | 17 | buf.append(s.substring(pos, e2)); |
18 | | | 18 | |
19 | | | 19 | |
| | | | |
20 | | | 20 | |
Precondition Violations (1)
Row |
Violation |
1 | Clone fragment #1 returns variables pos, insertLink , while Clone fragment #2 returns variables pos, insertLink |