newIndex = sourceName.indexOf(sourceSeparator, lastIndex); if (newIndex != -1) { newString.append(sourceName.substring(lastIndex, newIndex)); lastIndex = newIndex + 1; } else { newString.append(sourceName.substring(lastIndex)); break; }
newIndex = in.indexOf(oldPat, lastIndex); if (newIndex != -1) { newString.append(in.substring(lastIndex, newIndex) + newPat); lastIndex = newIndex + oldPat.length(); } else { newString.append(in.substring(lastIndex)); break; }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/mapping/domain/AdapterFactoryMappingDomain.java File path: /emf-2.4.1/src/org/eclipse/emf/mapping/domain/AdapterFactoryMappingDomain.java
Method name: String convertSeparator(String, char, char, int) Method name: String change(String, String, String)
Number of AST nodes: 6 Number of AST nodes: 6
1
newIndex = sourceName.indexOf(sourceSeparator, lastIndex);
1
newIndex = in.indexOf(oldPat, lastIndex);
2
        if (newIndex != -1) 
2
      if (newIndex != -1)
3
 
4
       {
3
      {
5
          newString.append(sourceName.substring(lastIndex, newIndex));
4
        newString.append(in.substring(lastIndex, newIndex) + newPat);
6
          lastIndex = newIndex + 1;
5
        lastIndex = newIndex + oldPat.length();
7
        }
6
      }
8
        else 
7
      else
9
  
10
      {
8
      {
11
          newString.append(sourceName.substring(lastIndex));
9
        newString.append(in.substring(lastIndex));
12
          break;
10
        break;
13
        }
11
      }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are declared in the same class
Number of node comparisons27
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    10
    newIndex = sourceName.indexOf(sourceSeparator, lastIndex);
    10
    newIndex = sourceName.indexOf(sourceSeparator, lastIndex);
    9
    newIndex = in.indexOf(oldPat, lastIndex);
    Differences
    Expression1Expression2Difference
    sourceSeparatoroldPatVARIABLE_NAME_MISMATCH
    charjava.lang.StringVARIABLE_TYPE_MISMATCH
    sourceNameinVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type char of variable sourceSeparator does not match with type java.lang.String of variable oldPat
    9
    newIndex = in.indexOf(oldPat, lastIndex);
    11
    if (newIndex != -1)
    10
    if (newIndex != -1)
    12
    newString.append(sourceName.substring(lastIndex, newIndex));
    12
    newString.append(sourceName.substring(lastIndex, newIndex));
    11
    newString.append(in.substring(lastIndex, newIndex) + newPat);
    Differences
    Expression1Expression2Difference
    sourceName.substring(lastIndex,newIndex)in.substring(lastIndex,newIndex) + newPatTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression sourceName.substring(lastIndex,newIndex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression in.substring(lastIndex,newIndex) + newPat cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11
    newString.append(in.substring(lastIndex, newIndex) + newPat);
    13
    lastIndex = newIndex + 1;
    13
    lastIndex = newIndex + 1;
    12
    lastIndex = newIndex + oldPat.length();
    Differences
    Expression1Expression2Difference
    1oldPat.length()TYPE_COMPATIBLE_REPLACEMENT
    12
    lastIndex = newIndex + oldPat.length();
    else
    else
    14
    newString.append(sourceName.substring(lastIndex));
    14
    newString.append(sourceName.substring(lastIndex));
    13
    newString.append(in.substring(lastIndex));
    Differences
    Expression1Expression2Difference
    sourceNameinVARIABLE_NAME_MISMATCH
    13
    newString.append(in.substring(lastIndex));
    15
    break;
    15
    break;
    14
    break;
    Preondition Violations
    Statement break; without innermost loop
    Statement break; without innermost loop
    14
    break;
    Precondition Violations (5)
    Row Violation
    1Type char of variable sourceSeparator does not match with type java.lang.String of variable oldPat
    2Expression sourceName.substring(lastIndex,newIndex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression in.substring(lastIndex,newIndex) + newPat cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Statement break; without innermost loop
    5Statement break; without innermost loop