for(int i = 0; i < beforeCaretText.length(); i++)
{
char ch = beforeCaretText.charAt(i);
switch(ch)
{
case '\n':
buf.append("\\n");
break;
case '\t':
buf.append("\\t");
break;
case '\\':
buf.append("\\\\");
break;
default:
buf.append(ch);
break;
}
}
for(int i = 0; i < afterCaretText.length(); i++)
{
char ch = afterCaretText.charAt(i);
switch(ch)
{
case '\n':
buf.append("\\n");
break;
case '\t':
buf.append("\\t");
break;
case '\\':
buf.append("\\\\");
break;
default:
buf.append(ch);
break;
}
}
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/AbbrevEditor.java
|
|
File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/AbbrevEditor.java
|
Method name: String getExpansion()
|
|
Method name: String getExpansion()
|
Number of AST nodes: 15
|
|
Number of AST nodes: 15
|
|
1 | for(int i = 0; i < beforeCaretText.length(); i++)↵ | | 1 | for(int i = 0; i < afterCaretText.length(); i++)↵
|
2 | {↵ | | 2 | {↵
|
3 | char ch = beforeCaretText.charAt(i);↵ | | 3 | char ch = afterCaretText.charAt(i);↵
|
4 | switch(ch)↵ | | 4 | switch(ch)↵
|
5 | {↵ | | 5 | {↵
|
6 | case '\n':↵ | | 6 | case '\n':↵
|
7 | buf.append("\\n");↵ | | 7 | buf.append("\\n");↵
|
8 | break;↵ | | 8 | break;↵
|
9 | case '\t':↵ | | 9 | case '\t':↵
|
10 | buf.append("\\t");↵ | | 10 | buf.append("\\t");↵
|
11 | break;↵ | | 11 | break;↵
|
12 | case '\\':↵ | | 12 | case '\\':↵
|
13 | buf.append("\\\\");↵ | | 13 | buf.append("\\\\");↵
|
14 | break;↵ | | 14 | break;↵
|
15 | default:↵ | | 15 | default:↵
|
16 | buf.append(ch);↵ | | 16 | buf.append(ch);↵
|
17 | break;↵ | | 17 | break;↵
|
18 | }↵ | | 18 | }↵
|
19 | } | | 19 | }
|
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.2 |
Clones location | Clones are in the same method |
Number of node comparisons | 95 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 15 |
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) | 9.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
4 | for (int i = 0; i < beforeCaretText.length(); i++) | | 21 | for (int i = 0; i < afterCaretText.length(); i++) |
5 | char ch = beforeCaretText.charAt(i); | | 22 | char ch = afterCaretText.charAt(i); |
6 | | | 23 | |
7 | | | 24 | |
8 | | | 25 | |
9 | | | 26 | |
10 | | | 27 | |
11 | | | 28 | |
12 | | | 29 | |
13 | | | 30 | |
14 | | | 31 | |
15 | | | 32 | |
16 | | | 33 | |
17 | | | 34 | |
18 | | | 35 | |
Precondition Violations (0)
Row |
Violation |