if (newParent != eInternalContainer() || (eContainerFeatureID != TreePackage.TREE_NODE__PARENT && newParent != null)) { if (EcoreUtil.isAncestor(this, newParent)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newParent != null) msgs = ((InternalEObject)newParent).eInverseAdd(this, TreePackage.TREE_NODE__CHILDREN, TreeNode.class, msgs); msgs = basicSetParent(newParent, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.TREE_NODE__PARENT, newParent, newParent));
if (newEModelElement != eInternalContainer() || (eContainerFeatureID != EcorePackage.EANNOTATION__EMODEL_ELEMENT && newEModelElement != null)) { if (EcoreUtil.isAncestor(this, newEModelElement)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newEModelElement != null) msgs = ((InternalEObject)newEModelElement).eInverseAdd(this, EcorePackage.EMODEL_ELEMENT__EANNOTATIONS, EModelElement.class, msgs); msgs = basicSetEModelElement(newEModelElement, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.EANNOTATION__EMODEL_ELEMENT, newEModelElement, newEModelElement));
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/edit/tree/impl/TreeNodeImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/impl/EAnnotationImpl.java
Method name: void setParent(TreeNode) Method name: void setEModelElement(EModelElement)
Number of AST nodes: 13 Number of AST nodes: 13
1
if (newParent != eInternalContainer() || (eContainerFeatureID != TreePackage.TREE_NODE__PARENT && newParent != null))
1
if (newEModelElement != eInternalContainer() || (eContainerFeatureID != EcorePackage.EANNOTATION__EMODEL_ELEMENT && newEModelElement != null))
2
    {
2
    {
3
      if (EcoreUtil.isAncestor(this, newParent))
3
      if (EcoreUtil.isAncestor(this, newEModelElement))
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 (newParent != null)
8
      if (newEModelElement != null)
9
        msgs = ((InternalEObject)newParent).eInverseAdd(this, TreePackage.TREE_NODE__CHILDREN, TreeNode.class, msgs);
9
        msgs = ((InternalEObject)newEModelElement).eInverseAdd(this, EcorePackage.EMODEL_ELEMENT__EANNOTATIONS, EModelElement.class, msgs);
10
      msgs = basicSetParent(newParent, msgs);
10
      msgs = basicSetEModelElement(newEModelElement, 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, TreePackage.TREE_NODE__PARENT, newParent, newParent));
14
      eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.EANNOTATION__EMODEL_ELEMENT, newEModelElement, newEModelElement));
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 statements12
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (newParent != eInternalContainer() || (eContainerFeatureID != TreePackage.TREE_NODE__PARENT && newParent != null))
    1
    if (newParent != eInternalContainer() || (eContainerFeatureID != TreePackage.TREE_NODE__PARENT && newParent != null))
    1
    if (newEModelElement != eInternalContainer() || (eContainerFeatureID != EcorePackage.EANNOTATION__EMODEL_ELEMENT && newEModelElement != null))
    Differences
    Expression1Expression2Difference
    newParentnewEModelElementVARIABLE_NAME_MISMATCH
    org.eclipse.emf.edit.tree.TreeNodeorg.eclipse.emf.ecore.EModelElementVARIABLE_TYPE_MISMATCH
    org.eclipse.emf.edit.tree.TreePackageorg.eclipse.emf.ecore.EcorePackageVARIABLE_TYPE_MISMATCH
    TREE_NODE__PARENTEANNOTATION__EMODEL_ELEMENTVARIABLE_NAME_MISMATCH
    newParentnewEModelElementVARIABLE_NAME_MISMATCH
    org.eclipse.emf.edit.tree.TreeNodeorg.eclipse.emf.ecore.EModelElementVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.edit.tree.TreeNode of variable newParent does not match with type org.eclipse.emf.ecore.EModelElement of variable newEModelElement
    • Make classes org.eclipse.emf.edit.tree.TreeNode and org.eclipse.emf.ecore.EModelElement extend a common superclass
    Type org.eclipse.emf.edit.tree.TreePackage of variable TreePackage does not match with type org.eclipse.emf.ecore.EcorePackage of variable EcorePackage
    • Make classes org.eclipse.emf.edit.tree.TreePackage and org.eclipse.emf.ecore.EcorePackage extend a common superclass
    Type org.eclipse.emf.edit.tree.TreeNode of variable newParent does not match with type org.eclipse.emf.ecore.EModelElement of variable newEModelElement
    • Make classes org.eclipse.emf.edit.tree.TreeNode and org.eclipse.emf.ecore.EModelElement extend a common superclass
    1
    if (newEModelElement != eInternalContainer() || (eContainerFeatureID != EcorePackage.EANNOTATION__EMODEL_ELEMENT && newEModelElement != null))
    2
    if (EcoreUtil.isAncestor(this, newParent))
    2
    if (EcoreUtil.isAncestor(this, newParent))
    2
    if (EcoreUtil.isAncestor(this, newEModelElement))
    Differences
    Expression1Expression2Difference
    newParentnewEModelElementVARIABLE_NAME_MISMATCH
    org.eclipse.emf.edit.tree.TreeNodeorg.eclipse.emf.ecore.EModelElementVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.edit.tree.TreeNode of variable newParent does not match with type org.eclipse.emf.ecore.EModelElement of variable newEModelElement
    • Make classes org.eclipse.emf.edit.tree.TreeNode and org.eclipse.emf.ecore.EModelElement extend a common superclass
    2
    if (EcoreUtil.isAncestor(this, newEModelElement))
    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 (newParent != null)
    7
    if (newParent != null)
    7
    if (newEModelElement != null)
    Differences
    Expression1Expression2Difference
    newParentnewEModelElementVARIABLE_NAME_MISMATCH
    org.eclipse.emf.edit.tree.TreeNodeorg.eclipse.emf.ecore.EModelElementVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.edit.tree.TreeNode of variable newParent does not match with type org.eclipse.emf.ecore.EModelElement of variable newEModelElement
    • Make classes org.eclipse.emf.edit.tree.TreeNode and org.eclipse.emf.ecore.EModelElement extend a common superclass
    7
    if (newEModelElement != null)
    8
    msgs = ((InternalEObject)newParent).eInverseAdd(this, TreePackage.TREE_NODE__CHILDREN, TreeNode.class, msgs);
    8
    msgs = ((InternalEObject)newParent).eInverseAdd(this, TreePackage.TREE_NODE__CHILDREN, TreeNode.class, msgs);
    8
    msgs = ((InternalEObject)newEModelElement).eInverseAdd(this, EcorePackage.EMODEL_ELEMENT__EANNOTATIONS, EModelElement.class, msgs);
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.edit.tree.TreePackageorg.eclipse.emf.ecore.EcorePackageVARIABLE_TYPE_MISMATCH
    TREE_NODE__CHILDRENEMODEL_ELEMENT__EANNOTATIONSVARIABLE_NAME_MISMATCH
    newParentnewEModelElementVARIABLE_NAME_MISMATCH
    org.eclipse.emf.edit.tree.TreeNodeorg.eclipse.emf.ecore.EModelElementVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.edit.tree.TreePackage of variable TreePackage does not match with type org.eclipse.emf.ecore.EcorePackage of variable EcorePackage
    • Make classes org.eclipse.emf.edit.tree.TreePackage and org.eclipse.emf.ecore.EcorePackage extend a common superclass
    Type org.eclipse.emf.edit.tree.TreeNode of variable newParent does not match with type org.eclipse.emf.ecore.EModelElement of variable newEModelElement
    • Make classes org.eclipse.emf.edit.tree.TreeNode and org.eclipse.emf.ecore.EModelElement extend a common superclass
    8
    msgs = ((InternalEObject)newEModelElement).eInverseAdd(this, EcorePackage.EMODEL_ELEMENT__EANNOTATIONS, EModelElement.class, msgs);
                                                                                                              
    9
    msgs = basicSetEModelElement(newEModelElement, msgs);
    Preondition Violations
    Unmatched statement msgs=basicSetEModelElement(newEModelElement,msgs); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9
    msgs = basicSetEModelElement(newEModelElement, msgs);
    9
    msgs = basicSetParent(newParent, msgs);
    9
    msgs = basicSetParent(newParent, msgs);
    Preondition Violations
    Unmatched statement msgs=basicSetParent(newParent,msgs); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                  
    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, TreePackage.TREE_NODE__PARENT, newParent, newParent));
    13
    eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.TREE_NODE__PARENT, newParent, newParent));
    13
    eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.EANNOTATION__EMODEL_ELEMENT, newEModelElement, newEModelElement));
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.edit.tree.TreePackageorg.eclipse.emf.ecore.EcorePackageVARIABLE_TYPE_MISMATCH
    TREE_NODE__PARENTEANNOTATION__EMODEL_ELEMENTVARIABLE_NAME_MISMATCH
    newParentnewEModelElementVARIABLE_NAME_MISMATCH
    org.eclipse.emf.edit.tree.TreeNodeorg.eclipse.emf.ecore.EModelElementVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.edit.tree.TreePackage of variable TreePackage does not match with type org.eclipse.emf.ecore.EcorePackage of variable EcorePackage
    • Make classes org.eclipse.emf.edit.tree.TreePackage and org.eclipse.emf.ecore.EcorePackage extend a common superclass
    Type org.eclipse.emf.edit.tree.TreeNode of variable newParent does not match with type org.eclipse.emf.ecore.EModelElement of variable newEModelElement
    • Make classes org.eclipse.emf.edit.tree.TreeNode and org.eclipse.emf.ecore.EModelElement extend a common superclass
    13
    eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.EANNOTATION__EMODEL_ELEMENT, newEModelElement, newEModelElement));
    Precondition Violations (11)
    Row Violation
    1Type org.eclipse.emf.edit.tree.TreeNode of variable newParent does not match with type org.eclipse.emf.ecore.EModelElement of variable newEModelElement
    2Type org.eclipse.emf.edit.tree.TreePackage of variable TreePackage does not match with type org.eclipse.emf.ecore.EcorePackage of variable EcorePackage
    3Type org.eclipse.emf.edit.tree.TreeNode of variable newParent does not match with type org.eclipse.emf.ecore.EModelElement of variable newEModelElement
    4Type org.eclipse.emf.edit.tree.TreeNode of variable newParent does not match with type org.eclipse.emf.ecore.EModelElement of variable newEModelElement
    5Type org.eclipse.emf.edit.tree.TreeNode of variable newParent does not match with type org.eclipse.emf.ecore.EModelElement of variable newEModelElement
    6Type org.eclipse.emf.edit.tree.TreePackage of variable TreePackage does not match with type org.eclipse.emf.ecore.EcorePackage of variable EcorePackage
    7Type org.eclipse.emf.edit.tree.TreeNode of variable newParent does not match with type org.eclipse.emf.ecore.EModelElement of variable newEModelElement
    8Unmatched statement msgs=basicSetEModelElement(newEModelElement,msgs); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement msgs=basicSetParent(newParent,msgs); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10Type org.eclipse.emf.edit.tree.TreePackage of variable TreePackage does not match with type org.eclipse.emf.ecore.EcorePackage of variable EcorePackage
    11Type org.eclipse.emf.edit.tree.TreeNode of variable newParent does not match with type org.eclipse.emf.ecore.EModelElement of variable newEModelElement