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; } }
for(int i = 0; i < str.length(); i++) { char ch = str.charAt(i); switch(ch) { case '<': buf.append("<"); break; case '>': buf.append(">"); 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/MiscUtilities.java
Method name: String getExpansion() Method name: String charsToEntities(String)
Number of AST nodes: 15 Number of AST nodes: 15
1
for(int i = 0; i < afterCaretText.length(); i++)
1
for(int i = 0; i < str.length(); i++)
2
			{
2
		{
3
				char ch = afterCaretText.charAt(i);
3
			char ch = str.charAt(i);
4
				switch(ch)
4
			switch(ch)
5
				{
5
			{
6
				case '\n':
6
			case '<':
7
					buf.append("\\n");
7
				buf.append("<");
8
					break;
8
				break;
9
				case '\t':
9
			case '>':
10
					buf.append("\\t");
10
				buf.append(">");
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
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes
Number of node comparisons95
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements15
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)8.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    21
    for (int i = 0; i < afterCaretText.length(); i++)
    21
    for (int i = 0; i < afterCaretText.length(); i++)
    2
    for (int i = 0; i < str.length(); i++)
    Differences
    Expression1Expression2Difference
    afterCaretTextstrVARIABLE_NAME_MISMATCH
    2
    for (int i = 0; i < str.length(); i++)
    22
    char ch = afterCaretText.charAt(i);
    22
    char ch = afterCaretText.charAt(i);
    3
    char ch = str.charAt(i);
    Differences
    Expression1Expression2Difference
    afterCaretTextstrVARIABLE_NAME_MISMATCH
    3
    char ch = str.charAt(i);
    23
    switch (ch)
    4
    switch (ch)
    24
    case '\n':
    24
    case '\n':
    11
    case '&':
    Differences
    Expression1Expression2Difference
    '\n''&'LITERAL_VALUE_MISMATCH
    11
    case '&':
    25
    buf.append("\\n");
    25
    buf.append("\\n");
    12
    buf.append("&");
    Differences
    Expression1Expression2Difference
    "\\n""&"LITERAL_VALUE_MISMATCH
    12
    buf.append("&");
    26
    break;
    13
    break;
    27
    case '\t':
    27
    case '\t':
    8
    case '>':
    Differences
    Expression1Expression2Difference
    '\t''>'LITERAL_VALUE_MISMATCH
    8
    case '>':
    28
    buf.append("\\t");
    28
    buf.append("\\t");
    9
    buf.append(">");
    Differences
    Expression1Expression2Difference
    "\\t"">"LITERAL_VALUE_MISMATCH
    9
    buf.append(">");
    29
    break;
    10
    break;
    30
    case '\\':
    30
    case '\\':
    5
    case '<':
    Differences
    Expression1Expression2Difference
    '\\''<'LITERAL_VALUE_MISMATCH
    5
    case '<':
    31
    buf.append("\\\\");
    31
    buf.append("\\\\");
    6
    buf.append("<");
    Differences
    Expression1Expression2Difference
    "\\\\""<"LITERAL_VALUE_MISMATCH
    6
    buf.append("<");
    32
    break;
    7
    break;
    33
    default:
    14
    default:
    34
    buf.append(ch);
    15
    buf.append(ch);
    35
    break;
    16
    break;
    Precondition Violations (0)
    Row Violation