if (str == null) {
return "";
}
StringBuffer result = new StringBuffer();
int pos = 0;
char ch;
while (pos < str.length()) {
ch = str.charAt(pos);
if (ch == '<') {
result.append("<");
} else if (ch == '>') {
result.append(">");
} else {
result.append(ch);
}
pos++;
}
return result.toString();
if (str == null) {
return "";
}
StringBuffer result = new StringBuffer();
int pos = 0;
char ch;
while (pos < str.length()) {
ch = str.charAt(pos);
if (ch == '<') {
result.append("<");
} else if (ch == '>') {
result.append(">");
} else {
result.append(ch);
}
pos++;
}
return result.toString();
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/util/ToolTipFactory.java
|
|
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/contact/list/HeaderItemToolTipFactory.java
|
Method name: String convert(String)
|
|
Method name: String convert(String)
|
Number of AST nodes: 14
|
|
Number of AST nodes: 14
|
|
1 | if (str == null) {↵ | | 1 | if (str == null) {↵
|
2 | return "";↵ | | 2 | return "";↵
|
3 | }↵ | | 3 | }↵
|
|
4 | StringBuffer result = new StringBuffer();↵ | | 4 | StringBuffer result = new StringBuffer();↵
|
5 | int pos = 0;↵ | | 5 | int pos = 0;↵
|
6 | char ch;↵ | | 6 | char ch;↵
|
|
7 | while (pos < str.length()) {↵ | | 7 | while (pos < str.length()) {↵
|
8 | ch = str.charAt(pos);↵ | | 8 | ch = str.charAt(pos);↵
|
|
9 | if (ch == '<') {↵ | | 9 | if (ch == '<') {↵
|
10 | result.append("<");↵ | | 10 | result.append("<");↵
|
11 | } else if (ch == '>') {↵ | | 11 | } else if (ch == '>') {↵
|
12 | result.append(">");↵ | | 12 | result.append(">");↵
|
13 | } else {↵ | | 13 | } else {↵
|
14 | result.append(ch);↵ | | 14 | result.append(ch);↵
|
15 | }↵ | | 15 | }↵
|
|
16 | pos++;↵ | | 16 | pos++;↵
|
17 | }↵ | | 17 | }↵
|
|
18 | return result.toString(); | | 18 | return result.toString();
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.7 |
Clones location | Clones are in different classes |
Number of node comparisons | 43 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 14 |
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) | 2.7 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (str == null) | | 1 | if (str == null) |
2 | | | 2 | |
3 | StringBuffer result = new StringBuffer(); | | 3 | StringBuffer result = new StringBuffer(); |
4 | int pos = 0; | | 4 | int pos = 0; |
5 | char ch; | | 5 | char ch; |
6 | while (pos < str.length()) | | 6 | while (pos < str.length()) |
7 | | | 7 | |
8 | | | 8 | |
9 | | | 9 | |
10 | | | 10 | |
11 | | | 11 | |
| | | | |
12 | | | 12 | |
13 | | | 13 | |
14 | return result.toString(); | | 14 | return result.toString(); |
Precondition Violations (0)
Row |
Violation |