for (int i=0; i < listAsArray.length; i++) { int oldIndex = indexOf(list, listAsArray[i], i); if (i != oldIndex) { list.move(i, oldIndex); } }
for (int i=0; i < listAsArray.length; i++) { int oldIndex = indexOf(list, listAsArray[i], i); if (i != oldIndex) { list.move(i, oldIndex); } }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/common/util/ECollections.java File path: /emf-2.4.1/src/org/eclipse/emf/common/util/ECollections.java
Method name: void sort(EList) Method name: void sort(EList, Comparator)
Number of AST nodes: 4 Number of AST nodes: 4
1
for (int i=0; i < listAsArray.length; i++)
1
for (int i=0; i < listAsArray.length; i++)
2
    {
2
    {
3
      int oldIndex = indexOf(list, listAsArray[i], i);
3
      int oldIndex = indexOf(list, listAsArray[i], i);
4
      if (i != oldIndex)
4
      if (i != oldIndex)
5
      {
5
      {
6
        list.move(i, oldIndex);
6
        list.move(i, oldIndex);
7
      }
7
      }
8
    }
8
    }
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.2
Clones locationClones are declared in the same class
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    for (int i = 0; i < listAsArray.length; i++)
    4
    for (int i = 0; i < listAsArray.length; i++)
    4
    int oldIndex = indexOf(list, listAsArray[i], i);
    4
    int oldIndex = indexOf(list, listAsArray[i], i);
    5
    int oldIndex = indexOf(list, listAsArray[i], i);
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.common.util.EList<>org.eclipse.emf.common.util.EListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.common.util.EList<> of variable list does not match with type org.eclipse.emf.common.util.EList<T> of variable list
    • Make classes org.eclipse.emf.common.util.EList<> and org.eclipse.emf.common.util.EList extend a common superclass
    5
    int oldIndex = indexOf(list, listAsArray[i], i);
    5
    if (i != oldIndex)
    6
    if (i != oldIndex)
    6
    list.move(i, oldIndex);
    6
    list.move(i, oldIndex);
    Preondition Violations
    Unmatched statement list.move(i,oldIndex); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                      
                                                      
    7
    list.move(i, oldIndex);
    Preondition Violations
    Unmatched statement list.move(i,oldIndex); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    list.move(i, oldIndex);
    Precondition Violations (4)
    Row Violation
    1Type org.eclipse.emf.common.util.EList<> of variable list does not match with type org.eclipse.emf.common.util.EList<T> of variable list
    2Unmatched statement list.move(i,oldIndex); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement list.move(i,oldIndex); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Clone fragment #1 returns variables i, oldIndex , while Clone fragment #2 returns variables i, oldIndex