InternalEObject container = ((InternalEObject)top).eInternalContainer(); if (container != null) { EReference containmentReference = top.eContainmentFeature(); EReference containerReference = containmentReference.getEOpposite(); if (containerReference != null && !containerReference.isTransient()) { saveHref(container, containerReference); return true; } }
InternalEObject container = ((InternalEObject)top).eInternalContainer(); if (container != null) { EReference containmentReference = top.eContainmentFeature(); EReference containerReference = containmentReference.getEOpposite(); if (containerReference != null && !containerReference.isTransient()) { saveEObjectSingle(top, containerReference); } }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLSaveImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLSaveImpl.java
Method name: boolean writeTopElements(EObject) Method name: void writeTopAttributes(EObject)
Number of AST nodes: 7 Number of AST nodes: 6
1
InternalEObject container = ((InternalEObject)top).eInternalContainer();
1
InternalEObject container = ((InternalEObject)top).eInternalContainer();
2
      if (container != null)
2
      if (container != null)
3
      {
3
      {
4
        EReference containmentReference = top.eContainmentFeature();
4
        EReference containmentReference = top.eContainmentFeature();
5
        EReference containerReference = containmentReference.getEOpposite();
5
        EReference containerReference = containmentReference.getEOpposite();
6
        if (containerReference != null && !containerReference.isTransient())
6
        if (containerReference != null && !containerReference.isTransient())
7
        {
7
        {
8
          saveHref(container, containerReference);
8
          saveEObjectSingle(top, containerReference);
9
          return true;
10
        }
9
        }
11
      }
10
      }
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 comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    2
    InternalEObject container = ((InternalEObject)top).eInternalContainer();
    2
    InternalEObject container = ((InternalEObject)top).eInternalContainer();
    3
    if (container != null)
    3
    if (container != null)
    4
    EReference containmentReference = top.eContainmentFeature();
    4
    EReference containmentReference = top.eContainmentFeature();
    5
    EReference containerReference = containmentReference.getEOpposite();
    5
    EReference containerReference = containmentReference.getEOpposite();
    6
    if (containerReference != null && !containerReference.isTransient())
    6
    if (containerReference != null && !containerReference.isTransient())
                                                                                              
    7
    saveEObjectSingle(top, containerReference);
    Preondition Violations
    Unmatched statement saveEObjectSingle(top,containerReference); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7
    saveEObjectSingle(top, containerReference);
    7
    saveHref(container, containerReference);
    7
    saveHref(container, containerReference);
    Preondition Violations
    Unmatched statement saveHref(container,containerReference); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                        
    8
    return true;
    8
    return true;
    Preondition Violations
    Unmatched return true;
                                  
    Precondition Violations (4)
    Row Violation
    1Unmatched statement saveEObjectSingle(top,containerReference); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement saveHref(container,containerReference); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched return true;
    4Clone fragment #1 returns variables container, containerReference , while Clone fragment #2 returns variables containerReference