if (newHelper != helper) { NotificationChain msgs = null; if (helper != null) msgs = ((InternalEObject)helper).eInverseRemove(this, MappingPackage.MAPPING_HELPER__MAPPER, MappingHelper.class, msgs); if (newHelper != null) msgs = ((InternalEObject)newHelper).eInverseAdd(this, MappingPackage.MAPPING_HELPER__MAPPER, MappingHelper.class, msgs); msgs = basicSetHelper(newHelper, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.MAPPING__HELPER, newHelper, newHelper));
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/mapping/impl/MappingImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/impl/EFactoryImpl.java
Method name: void setHelper(MappingHelper) Method name: void setEPackage(EPackage)
Number of AST nodes: 11 Number of AST nodes: 11
1
if (newHelper != helper)
1
if (newEPackage != ePackage)
2
    {
2
    {
3
      NotificationChain msgs = null;
3
      NotificationChain msgs = null;
4
      if (helper != null)
4
      if (ePackage != null)
5
        msgs = ((InternalEObject)helper).eInverseRemove(this, MappingPackage.MAPPING_HELPER__MAPPER, MappingHelper.class, msgs);
5
        msgs = ((InternalEObject)ePackage).eInverseRemove(this, EcorePackage.EPACKAGE__EFACTORY_INSTANCE, EPackage.class, msgs);
6
      if (newHelper != null)
6
      if (newEPackage != null)
7
        msgs = ((InternalEObject)newHelper).eInverseAdd(this, MappingPackage.MAPPING_HELPER__MAPPER, MappingHelper.class, msgs);
7
        msgs = ((InternalEObject)newEPackage).eInverseAdd(this, EcorePackage.EPACKAGE__EFACTORY_INSTANCE, EPackage.class, msgs);
8
      msgs = basicSetHelper(newHelper, 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, MappingPackage.MAPPING__HELPER, newHelper, newHelper));
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.4
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.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    NotificationChain msgs = null;
    2
    NotificationChain msgs = null;
    3
    if (helper != null)
    3
    if (helper != null)
    3
    if (ePackage != null)
    Differences
    Expression1Expression2Difference
    helperePackageVARIABLE_NAME_MISMATCH
    org.eclipse.emf.mapping.MappingHelperorg.eclipse.emf.ecore.EPackageVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.mapping.MappingHelper of variable helper does not match with type org.eclipse.emf.ecore.EPackage of variable ePackage
    • Make classes org.eclipse.emf.mapping.MappingHelper and org.eclipse.emf.ecore.EPackage extend a common superclass
    3
    if (ePackage != null)
    4
    msgs = ((InternalEObject)helper).eInverseRemove(this, MappingPackage.MAPPING_HELPER__MAPPER, MappingHelper.class, msgs);
    4
    msgs = ((InternalEObject)helper).eInverseRemove(this, MappingPackage.MAPPING_HELPER__MAPPER, MappingHelper.class, msgs);
    4
    msgs = ((InternalEObject)ePackage).eInverseRemove(this, EcorePackage.EPACKAGE__EFACTORY_INSTANCE, EPackage.class, msgs);
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.mapping.MappingPackageorg.eclipse.emf.ecore.EcorePackageVARIABLE_TYPE_MISMATCH
    MAPPING_HELPER__MAPPEREPACKAGE__EFACTORY_INSTANCEVARIABLE_NAME_MISMATCH
    helperePackageVARIABLE_NAME_MISMATCH
    org.eclipse.emf.mapping.MappingHelperorg.eclipse.emf.ecore.EPackageVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.mapping.MappingPackage of variable MappingPackage does not match with type org.eclipse.emf.ecore.EcorePackage of variable EcorePackage
    • Make classes org.eclipse.emf.mapping.MappingPackage and org.eclipse.emf.ecore.EcorePackage extend a common superclass
    Type org.eclipse.emf.mapping.MappingHelper of variable helper does not match with type org.eclipse.emf.ecore.EPackage of variable ePackage
    • Make classes org.eclipse.emf.mapping.MappingHelper 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 (newHelper != null)
    5
    if (newHelper != null)
    5
    if (newEPackage != null)
    Differences
    Expression1Expression2Difference
    newHelpernewEPackageVARIABLE_NAME_MISMATCH
    org.eclipse.emf.mapping.MappingHelperorg.eclipse.emf.ecore.EPackageVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.mapping.MappingHelper of variable newHelper does not match with type org.eclipse.emf.ecore.EPackage of variable newEPackage
    • Make classes org.eclipse.emf.mapping.MappingHelper and org.eclipse.emf.ecore.EPackage extend a common superclass
    5
    if (newEPackage != null)
    6
    msgs = ((InternalEObject)newHelper).eInverseAdd(this, MappingPackage.MAPPING_HELPER__MAPPER, MappingHelper.class, msgs);
    6
    msgs = ((InternalEObject)newHelper).eInverseAdd(this, MappingPackage.MAPPING_HELPER__MAPPER, MappingHelper.class, msgs);
    6
    msgs = ((InternalEObject)newEPackage).eInverseAdd(this, EcorePackage.EPACKAGE__EFACTORY_INSTANCE, EPackage.class, msgs);
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.mapping.MappingPackageorg.eclipse.emf.ecore.EcorePackageVARIABLE_TYPE_MISMATCH
    MAPPING_HELPER__MAPPEREPACKAGE__EFACTORY_INSTANCEVARIABLE_NAME_MISMATCH
    newHelpernewEPackageVARIABLE_NAME_MISMATCH
    org.eclipse.emf.mapping.MappingHelperorg.eclipse.emf.ecore.EPackageVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.mapping.MappingPackage of variable MappingPackage does not match with type org.eclipse.emf.ecore.EcorePackage of variable EcorePackage
    • Make classes org.eclipse.emf.mapping.MappingPackage and org.eclipse.emf.ecore.EcorePackage extend a common superclass
    Type org.eclipse.emf.mapping.MappingHelper of variable newHelper does not match with type org.eclipse.emf.ecore.EPackage of variable newEPackage
    • Make classes org.eclipse.emf.mapping.MappingHelper 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 = basicSetHelper(newHelper, msgs);
    7
    msgs = basicSetHelper(newHelper, msgs);
    Preondition Violations
    Unmatched statement msgs=basicSetHelper(newHelper,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 (8)
    Row Violation
    1Type org.eclipse.emf.mapping.MappingHelper of variable helper does not match with type org.eclipse.emf.ecore.EPackage of variable ePackage
    2Type org.eclipse.emf.mapping.MappingPackage of variable MappingPackage does not match with type org.eclipse.emf.ecore.EcorePackage of variable EcorePackage
    3Type org.eclipse.emf.mapping.MappingHelper of variable helper does not match with type org.eclipse.emf.ecore.EPackage of variable ePackage
    4Type org.eclipse.emf.mapping.MappingHelper of variable newHelper does not match with type org.eclipse.emf.ecore.EPackage of variable newEPackage
    5Type org.eclipse.emf.mapping.MappingPackage of variable MappingPackage does not match with type org.eclipse.emf.ecore.EcorePackage of variable EcorePackage
    6Type org.eclipse.emf.mapping.MappingHelper of variable newHelper does not match with type org.eclipse.emf.ecore.EPackage of variable newEPackage
    7Unmatched 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
    8Unmatched statement msgs=basicSetHelper(newHelper,msgs); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted