if (newEFactoryInstance != eFactoryInstance) { NotificationChain msgs = null; if (eFactoryInstance != null) msgs = ((InternalEObject)eFactoryInstance).eInverseRemove(this, EcorePackage.EFACTORY__EPACKAGE, EFactory.class, msgs); if (newEFactoryInstance != null) msgs = ((InternalEObject)newEFactoryInstance).eInverseAdd(this, EcorePackage.EFACTORY__EPACKAGE, EFactory.class, msgs); msgs = basicSetEFactoryInstance(newEFactoryInstance, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.EPACKAGE__EFACTORY_INSTANCE, newEFactoryInstance, newEFactoryInstance));
if (newEPackage != ePackage) { NotificationChain msgs = null; if (ePackage != null) msgs = ((InternalEObject)ePackage).eInverseRemove(this, EcorePackage.EPACKAGE__EFACTORY_INSTANCE, EPackage.class, msgs); if (newEPackage != null) msgs = ((InternalEObject)newEPackage).eInverseAdd(this, EcorePackage.EPACKAGE__EFACTORY_INSTANCE, EPackage.class, msgs); msgs = basicSetEPackage(newEPackage, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.EFACTORY__EPACKAGE, newEPackage, newEPackage));
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/impl/EPackageImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/impl/EFactoryImpl.java
Method name: void setEFactoryInstance(EFactory) Method name: void setEPackage(EPackage)
Number of AST nodes: 11 Number of AST nodes: 11
1
if (newEFactoryInstance != eFactoryInstance)
1
if (newEPackage != ePackage)
2
    {
2
    {
3
      NotificationChain msgs = null;
3
      NotificationChain msgs = null;
4
      if (eFactoryInstance != null)
4
      if (ePackage != null)
5
        msgs = ((InternalEObject)eFactoryInstance).eInverseRemove(this, EcorePackage.EFACTORY__EPACKAGE, EFactory.class, msgs);
5
        msgs = ((InternalEObject)ePackage).eInverseRemove(this, EcorePackage.EPACKAGE__EFACTORY_INSTANCE, EPackage.class, msgs);
6
      if (newEFactoryInstance != null)
6
      if (newEPackage != null)
7
        msgs = ((InternalEObject)newEFactoryInstance).eInverseAdd(this, EcorePackage.EFACTORY__EPACKAGE, EFactory.class, msgs);
7
        msgs = ((InternalEObject)newEPackage).eInverseAdd(this, EcorePackage.EPACKAGE__EFACTORY_INSTANCE, EPackage.class, msgs);
8
      msgs = basicSetEFactoryInstance(newEFactoryInstance, msgs);
8
      msgs = basicSetEPackage(newEPackage, msgs);
9
      if (msgs != null) msgs.dispatch();
9
      if (msgs != null) msgs.dispatch();
10
    }
10
    }
11
    else if (eNotificationRequired())
11
    else if (eNotificationRequired())
12
      eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.EPACKAGE__EFACTORY_INSTANCE, newEFactoryInstance, newEFactoryInstance));
12
      eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.EFACTORY__EPACKAGE, newEPackage, newEPackage));
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.5
Clones locationClones are in different classes having the same super class
Number of node comparisons32
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    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.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    NotificationChain msgs = null;
    2
    NotificationChain msgs = null;
    3
    if (eFactoryInstance != null)
    3
    if (eFactoryInstance != null)
    3
    if (ePackage != null)
    Differences
    Expression1Expression2Difference
    eFactoryInstanceePackageVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.EFactoryorg.eclipse.emf.ecore.EPackageVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.EFactory of variable eFactoryInstance does not match with type org.eclipse.emf.ecore.EPackage of variable ePackage
    • Make classes org.eclipse.emf.ecore.EFactory and org.eclipse.emf.ecore.EPackage extend a common superclass
    3
    if (ePackage != null)
    4
    msgs = ((InternalEObject)eFactoryInstance).eInverseRemove(this, EcorePackage.EFACTORY__EPACKAGE, EFactory.class, msgs);
    4
    msgs = ((InternalEObject)eFactoryInstance).eInverseRemove(this, EcorePackage.EFACTORY__EPACKAGE, EFactory.class, msgs);
    4
    msgs = ((InternalEObject)ePackage).eInverseRemove(this, EcorePackage.EPACKAGE__EFACTORY_INSTANCE, EPackage.class, msgs);
    Differences
    Expression1Expression2Difference
    EFACTORY__EPACKAGEEPACKAGE__EFACTORY_INSTANCEVARIABLE_NAME_MISMATCH
    eFactoryInstanceePackageVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.EFactoryorg.eclipse.emf.ecore.EPackageVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.EFactory of variable eFactoryInstance does not match with type org.eclipse.emf.ecore.EPackage of variable ePackage
    • Make classes org.eclipse.emf.ecore.EFactory and org.eclipse.emf.ecore.EPackage extend a common superclass
    4
    msgs = ((InternalEObject)ePackage).eInverseRemove(this, EcorePackage.EPACKAGE__EFACTORY_INSTANCE, EPackage.class, msgs);
    5
    if (newEFactoryInstance != null)
    5
    if (newEFactoryInstance != null)
    5
    if (newEPackage != null)
    Differences
    Expression1Expression2Difference
    newEFactoryInstancenewEPackageVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.EFactoryorg.eclipse.emf.ecore.EPackageVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.EFactory of variable newEFactoryInstance does not match with type org.eclipse.emf.ecore.EPackage of variable newEPackage
    • Make classes org.eclipse.emf.ecore.EFactory and org.eclipse.emf.ecore.EPackage extend a common superclass
    5
    if (newEPackage != null)
    6
    msgs = ((InternalEObject)newEFactoryInstance).eInverseAdd(this, EcorePackage.EFACTORY__EPACKAGE, EFactory.class, msgs);
    6
    msgs = ((InternalEObject)newEFactoryInstance).eInverseAdd(this, EcorePackage.EFACTORY__EPACKAGE, EFactory.class, msgs);
    6
    msgs = ((InternalEObject)newEPackage).eInverseAdd(this, EcorePackage.EPACKAGE__EFACTORY_INSTANCE, EPackage.class, msgs);
    Differences
    Expression1Expression2Difference
    EFACTORY__EPACKAGEEPACKAGE__EFACTORY_INSTANCEVARIABLE_NAME_MISMATCH
    newEFactoryInstancenewEPackageVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.EFactoryorg.eclipse.emf.ecore.EPackageVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.EFactory of variable newEFactoryInstance does not match with type org.eclipse.emf.ecore.EPackage of variable newEPackage
    • Make classes org.eclipse.emf.ecore.EFactory and org.eclipse.emf.ecore.EPackage extend a common superclass
    6
    msgs = ((InternalEObject)newEPackage).eInverseAdd(this, EcorePackage.EPACKAGE__EFACTORY_INSTANCE, EPackage.class, msgs);
                                                                                          
    7
    msgs = basicSetEPackage(newEPackage, msgs);
    Preondition Violations
    Unmatched statement msgs=basicSetEPackage(newEPackage,msgs); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    msgs = basicSetEPackage(newEPackage, msgs);
    7
    msgs = basicSetEFactoryInstance(newEFactoryInstance, msgs);
    7
    msgs = basicSetEFactoryInstance(newEFactoryInstance, msgs);
    Preondition Violations
    Unmatched statement msgs=basicSetEFactoryInstance(newEFactoryInstance,msgs); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                          
    8
    if (msgs != null)
    8
    if (msgs != null)
    9
    msgs.dispatch();
    9
    msgs.dispatch();
    Precondition Violations (6)
    Row Violation
    1Type org.eclipse.emf.ecore.EFactory of variable eFactoryInstance does not match with type org.eclipse.emf.ecore.EPackage of variable ePackage
    2Type org.eclipse.emf.ecore.EFactory of variable eFactoryInstance does not match with type org.eclipse.emf.ecore.EPackage of variable ePackage
    3Type org.eclipse.emf.ecore.EFactory of variable newEFactoryInstance does not match with type org.eclipse.emf.ecore.EPackage of variable newEPackage
    4Type org.eclipse.emf.ecore.EFactory of variable newEFactoryInstance does not match with type org.eclipse.emf.ecore.EPackage of variable newEPackage
    5Unmatched statement msgs=basicSetEPackage(newEPackage,msgs); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement msgs=basicSetEFactoryInstance(newEFactoryInstance,msgs); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted