170-2-5

switch (featureID) { case Ecore2XMLPackage.XML_INFO__NAME: setName(NAME_EDEFAULT); return; case Ecore2XMLPackage.XML_INFO__TARGET_NAMESPACE: setTargetNamespace(TARGET_NAMESPACE_EDEFAULT); return; case Ecore2XMLPackage.XML_INFO__XML_REPRESENTATION: setXMLRepresentation(XML_REPRESENTATION_EDEFAULT); return; } super.eUnset(featureID);
switch (featureID) { case TreePackage.TREE_NODE__PARENT: setParent((TreeNode)null); return; case TreePackage.TREE_NODE__CHILDREN: getChildren().clear(); return; case TreePackage.TREE_NODE__DATA: setData((EObject)null); return; } super.eUnset(featureID);

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/mapping/ecore2xml/impl/XMLInfoImpl.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/edit/tree/impl/TreeNodeImpl.java
Method name: `void eUnset(int)` |  | Method name: `void eUnset(int)`
Number of AST nodes: 11 |  | Number of AST nodes: 11

1

    switch (featureID)↵

1

    switch (featureID)↵

2

        {↵

2

        {↵

3

          case Ecore2XMLPackage.XML_INFO__NAME:↵

3

          case ↵

4

            setName(NAME_EDEFAULT↵

4

    TreePackage.TREE_NODE__PARENT:↵

5

    );↵

5

            setParent((TreeNode)null);↵

6

            return;↵

6

            return;↵

7

          case Ecore2XMLPackage.XML_INFO__TARGET_NAMESPACE:↵

7

          case TreePackage.TREE_NODE__CHILDREN:↵

8

            setTargetNamespace(TARGET_NAMESPACE_EDEFAULT);↵

8

            getChildren().clear();↵

9

            return;↵

9

            return;↵

10

          case Ecore2XMLPackage.XML_INFO__XML_REPRESENTATION:↵

10

          case ↵

11

            setXMLRepresentation(XML_REPRESENTATION_EDEFAULT↵

11

    TreePackage.TREE_NODE__DATA:↵

12

    );↵

12

            setData((EObject)null);↵

13

            return;↵

13

            return;↵

14

        }↵

14

        }↵

15

        super.eUnset(featureID);

15

        super.eUnset(featureID);

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 59

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 8
   Number of unmapped statements in the first code fragment | 3
   Number of unmapped statements in the second code fragment | 3
   Time elapsed for statement mapping (ms) | 4.4
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       switch (featureID)

   1

       switch (featureID)

   2

       case Ecore2XMLPackage.XML_INFO__NAME:

   2 | case Ecore2XMLPackage.XML_INFO__NAME:
   2 | case TreePackage.TREE_NODE__PARENT:

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage | org.eclipse.emf.edit.tree.TreePackage | SUBCLASS_TYPE_MISMATCH
   XML_INFO__NAME | TREE_NODE__PARENT | VARIABLE_NAME_MISMATCH

   2

       case TreePackage.TREE_NODE__PARENT:

   3 | setParent((TreeNode)null);

   Preondition Violations
   Unmatched statement setParent((TreeNode)null); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted

   3

       setParent((TreeNode)null);

   3

       setName(NAME_EDEFAULT);

   4

       return;

   4

       return;

   5

       case Ecore2XMLPackage.XML_INFO__TARGET_NAMESPACE:

   5 | case Ecore2XMLPackage.XML_INFO__TARGET_NAMESPACE:
   5 | case TreePackage.TREE_NODE__CHILDREN:

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage | org.eclipse.emf.edit.tree.TreePackage | SUBCLASS_TYPE_MISMATCH
   XML_INFO__TARGET_NAMESPACE | TREE_NODE__CHILDREN | VARIABLE_NAME_MISMATCH

   5

       case TreePackage.TREE_NODE__CHILDREN:

   6 | getChildren().clear();

   Preondition Violations
   Unmatched statement getChildren().clear(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted

   6

       getChildren().clear();

   6

       setTargetNamespace(TARGET_NAMESPACE_EDEFAULT);

   7

       return;

   7

       return;

   8

       case Ecore2XMLPackage.XML_INFO__XML_REPRESENTATION:

   8 | case Ecore2XMLPackage.XML_INFO__XML_REPRESENTATION:
   8 | case TreePackage.TREE_NODE__DATA:

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage | org.eclipse.emf.edit.tree.TreePackage | SUBCLASS_TYPE_MISMATCH
   XML_INFO__XML_REPRESENTATION | TREE_NODE__DATA | VARIABLE_NAME_MISMATCH

   8

       case TreePackage.TREE_NODE__DATA:

   9 | setData((EObject)null);

   Preondition Violations
   Unmatched statement setData((EObject)null); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted

   9

       setData((EObject)null);

   9

       setXMLRepresentation(XML_REPRESENTATION_EDEFAULT);

   10

       return;

   10

       return;

   11

       super.eUnset(featureID);

   11 | super.eUnset(featureID);
   11 | super.eUnset(featureID);

   Preondition Violations
   Super method call super.eUnset(featureID); cannot be extracted from method
   Super method call super.eUnset(featureID); cannot be extracted from method

   11

       super.eUnset(featureID);

   Precondition Violations (5)
   Row | Violation
   --- | ---
   1 | Unmatched statement setParent((TreeNode)null); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
   2 | Unmatched statement getChildren().clear(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
   3 | Unmatched statement setData((EObject)null); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
   4 | Super method call super.eUnset(featureID); cannot be extracted from method
   5 | Super method call super.eUnset(featureID); cannot be extracted from method