if (newNestedIn != eInternalContainer() || (eContainerFeatureID != MappingPackage.MAPPING__NESTED_IN && newNestedIn != null)) { if (EcoreUtil.isAncestor(this, newNestedIn)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newNestedIn != null) msgs = ((InternalEObject)newNestedIn).eInverseAdd(this, MappingPackage.MAPPING__NESTED, Mapping.class, msgs); msgs = basicSetNestedIn(newNestedIn, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.MAPPING__NESTED_IN, newNestedIn, newNestedIn));
if (newNestedIn != eInternalContainer() || (eContainerFeatureID != MappingPackage.MAPPING_HELPER__NESTED_IN && newNestedIn != null)) { if (EcoreUtil.isAncestor(this, newNestedIn)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newNestedIn != null) msgs = ((InternalEObject)newNestedIn).eInverseAdd(this, MappingPackage.MAPPING_HELPER__NESTED, MappingHelper.class, msgs); msgs = basicSetNestedIn(newNestedIn, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.MAPPING_HELPER__NESTED_IN, newNestedIn, newNestedIn));
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/mapping/impl/MappingHelperImpl.java
Method name: void setNestedIn(Mapping) Method name: void setNestedIn(MappingHelper)
Number of AST nodes: 13 Number of AST nodes: 13
1
if (newNestedIn != eInternalContainer() || (eContainerFeatureID != MappingPackage.MAPPING__NESTED_IN && newNestedIn != null))
1
if (newNestedIn != eInternalContainer() || (eContainerFeatureID != MappingPackage.MAPPING_HELPER__NESTED_IN && newNestedIn != null))
2
    {
2
    {
3
      if (EcoreUtil.isAncestor(this, newNestedIn))
3
      if (EcoreUtil.isAncestor(this, newNestedIn))
4
        throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
4
        throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
5
      NotificationChain msgs = null;
5
      NotificationChain msgs = null;
6
      if (eInternalContainer() != null)
6
      if (eInternalContainer() != null)
7
        msgs = eBasicRemoveFromContainer(msgs);
7
        msgs = eBasicRemoveFromContainer(msgs);
8
      if (newNestedIn != null)
8
      if (newNestedIn != null)
9
        msgs = ((InternalEObject)newNestedIn).eInverseAdd(this, MappingPackage.MAPPING__NESTED, Mapping.class, msgs);
9
        msgs = ((InternalEObject)newNestedIn).eInverseAdd(this, MappingPackage.MAPPING_HELPER__NESTED, MappingHelper.class, msgs);
10
      msgs = basicSetNestedIn(newNestedIn, msgs);
10
      msgs = basicSetNestedIn(newNestedIn, msgs);
11
      if (msgs != null) msgs.dispatch();
11
      if (msgs != null) msgs.dispatch();
12
    }
12
    }
13
    else if (eNotificationRequired())
13
    else if (eNotificationRequired())
14
      eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.MAPPING__NESTED_IN, newNestedIn, newNestedIn));
14
      eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.MAPPING_HELPER__NESTED_IN, newNestedIn, newNestedIn));
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.8
Clones locationClones are in different classes having the same super class
Number of node comparisons59
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (newNestedIn != eInternalContainer() || (eContainerFeatureID != MappingPackage.MAPPING__NESTED_IN && newNestedIn != null))
    1
    if (newNestedIn != eInternalContainer() || (eContainerFeatureID != MappingPackage.MAPPING__NESTED_IN && newNestedIn != null))
    1
    if (newNestedIn != eInternalContainer() || (eContainerFeatureID != MappingPackage.MAPPING_HELPER__NESTED_IN && newNestedIn != null))
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.mapping.Mappingorg.eclipse.emf.mapping.MappingHelperVARIABLE_TYPE_MISMATCH
    MAPPING__NESTED_INMAPPING_HELPER__NESTED_INVARIABLE_NAME_MISMATCH
    org.eclipse.emf.mapping.Mappingorg.eclipse.emf.mapping.MappingHelperVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.mapping.Mapping of variable newNestedIn does not match with type org.eclipse.emf.mapping.MappingHelper of variable newNestedIn
    • Make classes org.eclipse.emf.mapping.Mapping and org.eclipse.emf.mapping.MappingHelper extend a common superclass
    Type org.eclipse.emf.mapping.Mapping of variable newNestedIn does not match with type org.eclipse.emf.mapping.MappingHelper of variable newNestedIn
    • Make classes org.eclipse.emf.mapping.Mapping and org.eclipse.emf.mapping.MappingHelper extend a common superclass
    1
    if (newNestedIn != eInternalContainer() || (eContainerFeatureID != MappingPackage.MAPPING_HELPER__NESTED_IN && newNestedIn != null))
    2
    if (EcoreUtil.isAncestor(this, newNestedIn))
    2
    if (EcoreUtil.isAncestor(this, newNestedIn))
    2
    if (EcoreUtil.isAncestor(this, newNestedIn))
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.mapping.Mappingorg.eclipse.emf.mapping.MappingHelperVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.mapping.Mapping of variable newNestedIn does not match with type org.eclipse.emf.mapping.MappingHelper of variable newNestedIn
    • Make classes org.eclipse.emf.mapping.Mapping and org.eclipse.emf.mapping.MappingHelper extend a common superclass
    2
    if (EcoreUtil.isAncestor(this, newNestedIn))
    3
    throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
    3
    throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
    4
    NotificationChain msgs = null;
    4
    NotificationChain msgs = null;
    5
    if (eInternalContainer() != null)
    5
    if (eInternalContainer() != null)
    6
    msgs = eBasicRemoveFromContainer(msgs);
    6
    msgs = eBasicRemoveFromContainer(msgs);
    7
    if (newNestedIn != null)
    7
    if (newNestedIn != null)
    7
    if (newNestedIn != null)
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.mapping.Mappingorg.eclipse.emf.mapping.MappingHelperVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.mapping.Mapping of variable newNestedIn does not match with type org.eclipse.emf.mapping.MappingHelper of variable newNestedIn
    • Make classes org.eclipse.emf.mapping.Mapping and org.eclipse.emf.mapping.MappingHelper extend a common superclass
    7
    if (newNestedIn != null)
    8
    msgs = ((InternalEObject)newNestedIn).eInverseAdd(this, MappingPackage.MAPPING__NESTED, Mapping.class, msgs);
    8
    msgs = ((InternalEObject)newNestedIn).eInverseAdd(this, MappingPackage.MAPPING__NESTED, Mapping.class, msgs);
    8
    msgs = ((InternalEObject)newNestedIn).eInverseAdd(this, MappingPackage.MAPPING_HELPER__NESTED, MappingHelper.class, msgs);
    Differences
    Expression1Expression2Difference
    MAPPING__NESTEDMAPPING_HELPER__NESTEDVARIABLE_NAME_MISMATCH
    org.eclipse.emf.mapping.Mappingorg.eclipse.emf.mapping.MappingHelperVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.mapping.Mapping of variable newNestedIn does not match with type org.eclipse.emf.mapping.MappingHelper of variable newNestedIn
    • Make classes org.eclipse.emf.mapping.Mapping and org.eclipse.emf.mapping.MappingHelper extend a common superclass
    8
    msgs = ((InternalEObject)newNestedIn).eInverseAdd(this, MappingPackage.MAPPING_HELPER__NESTED, MappingHelper.class, msgs);
    9
    msgs = basicSetNestedIn(newNestedIn, msgs);
    9
    msgs = basicSetNestedIn(newNestedIn, msgs);
    9
    msgs = basicSetNestedIn(newNestedIn, msgs);
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.mapping.Mappingorg.eclipse.emf.mapping.MappingHelperVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.mapping.Mapping of variable newNestedIn does not match with type org.eclipse.emf.mapping.MappingHelper of variable newNestedIn
    • Make classes org.eclipse.emf.mapping.Mapping and org.eclipse.emf.mapping.MappingHelper extend a common superclass
    9
    msgs = basicSetNestedIn(newNestedIn, msgs);
    10
    if (msgs != null)
    10
    if (msgs != null)
    11
    msgs.dispatch();
    11
    msgs.dispatch();
    12
    else if (eNotificationRequired())
    12
    else if (eNotificationRequired())
    13
    eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.MAPPING__NESTED_IN, newNestedIn, newNestedIn));
    13
    eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.MAPPING__NESTED_IN, newNestedIn, newNestedIn));
    13
    eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.MAPPING_HELPER__NESTED_IN, newNestedIn, newNestedIn));
    Differences
    Expression1Expression2Difference
    MAPPING__NESTED_INMAPPING_HELPER__NESTED_INVARIABLE_NAME_MISMATCH
    org.eclipse.emf.mapping.Mappingorg.eclipse.emf.mapping.MappingHelperVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.mapping.Mapping of variable newNestedIn does not match with type org.eclipse.emf.mapping.MappingHelper of variable newNestedIn
    • Make classes org.eclipse.emf.mapping.Mapping and org.eclipse.emf.mapping.MappingHelper extend a common superclass
    13
    eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.MAPPING_HELPER__NESTED_IN, newNestedIn, newNestedIn));
    Precondition Violations (7)
    Row Violation
    1Type org.eclipse.emf.mapping.Mapping of variable newNestedIn does not match with type org.eclipse.emf.mapping.MappingHelper of variable newNestedIn
    2Type org.eclipse.emf.mapping.Mapping of variable newNestedIn does not match with type org.eclipse.emf.mapping.MappingHelper of variable newNestedIn
    3Type org.eclipse.emf.mapping.Mapping of variable newNestedIn does not match with type org.eclipse.emf.mapping.MappingHelper of variable newNestedIn
    4Type org.eclipse.emf.mapping.Mapping of variable newNestedIn does not match with type org.eclipse.emf.mapping.MappingHelper of variable newNestedIn
    5Type org.eclipse.emf.mapping.Mapping of variable newNestedIn does not match with type org.eclipse.emf.mapping.MappingHelper of variable newNestedIn
    6Type org.eclipse.emf.mapping.Mapping of variable newNestedIn does not match with type org.eclipse.emf.mapping.MappingHelper of variable newNestedIn
    7Type org.eclipse.emf.mapping.Mapping of variable newNestedIn does not match with type org.eclipse.emf.mapping.MappingHelper of variable newNestedIn