for (int i = 0; i < existingSize; ++i) { int newPosition = indices[i]; int oldPosition = size + i; if (newPosition != oldPosition) { internalEObjects.move(newPosition, oldPosition); } } recycle(existingValues); recycle(indices);
for (int i = 0; i < existingSize; ++i) { int newPosition = indices[i]; int oldPosition = size + i; if (newPosition != oldPosition) { featureMap.move(newPosition, oldPosition); } } recycle(existingValues); recycle(indices);
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/resource/impl/BinaryResourceImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/resource/impl/BinaryResourceImpl.java
Method name: void loadEObjects(InternalEList) Method name: void loadFeatureMap(FeatureMap.Internal)
Number of AST nodes: 7 Number of AST nodes: 7
1
for (int i = 0; i < existingSize; ++i)
1
for (int i = 0; i < existingSize; ++i)
2
        {
2
        {
3
          int newPosition = indices[i];
3
          int newPosition = indices[i];
4
          int oldPosition = size + i;
4
          int oldPosition = size + i;
5
          if (newPosition != oldPosition)
5
          if (newPosition != oldPosition)
6
          {
6
          {
7
            internalEObjects.move(newPosition, oldPosition);
7
            featureMap.move(newPosition, oldPosition);
8
          }
8
          }
9
        }
9
        }
10
        recycle(existingValues);
10
        recycle(existingValues);
11
        recycle(indices);
11
        recycle(indices);
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.3
Clones locationClones are declared in the same class
Number of node comparisons19
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    31
    for (int i = 0; i < existingSize; ++i)
    30
    for (int i = 0; i < existingSize; ++i)
    32
    int newPosition = indices[i];
    31
    int newPosition = indices[i];
    33
    int oldPosition = size + i;
    32
    int oldPosition = size + i;
    34
    if (newPosition != oldPosition)
    33
    if (newPosition != oldPosition)
                                                                                              
    34
    featureMap.move(newPosition, oldPosition);
    Preondition Violations
    Unmatched statement featureMap.move(newPosition,oldPosition); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    34
    featureMap.move(newPosition, oldPosition);
    35
    internalEObjects.move(newPosition, oldPosition);
    35
    internalEObjects.move(newPosition, oldPosition);
    Preondition Violations
    Unmatched statement internalEObjects.move(newPosition,oldPosition); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                          
    36
    recycle(existingValues);
    36
    recycle(existingValues);
    35
    recycle(existingValues);
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.ecore.InternalEObject[]org.eclipse.emf.ecore.util.FeatureMap.Entry.Internal[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.InternalEObject[] of variable existingValues does not match with type org.eclipse.emf.ecore.util.FeatureMap.Entry.Internal[] of variable existingValues
    • Make classes org.eclipse.emf.ecore.InternalEObject[] and org.eclipse.emf.ecore.util.FeatureMap.Entry.Internal[] extend a common superclass
    35
    recycle(existingValues);
    37
    recycle(indices);
    36
    recycle(indices);
    Precondition Violations (4)
    Row Violation
    1Unmatched statement featureMap.move(newPosition,oldPosition); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement internalEObjects.move(newPosition,oldPosition); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type org.eclipse.emf.ecore.InternalEObject[] of variable existingValues does not match with type org.eclipse.emf.ecore.util.FeatureMap.Entry.Internal[] of variable existingValues
    4Clone fragment #1 returns variables newPosition, oldPosition , while Clone fragment #2 returns variables newPosition, oldPosition