162-1-2

if (eFeature instanceof EReference && ((EReference)eFeature).isContainer()) { eSettingDelegate(eFeature).dynamicSet(this, null, -1, newValue); } else { if (!eFeature.isUnsettable()) { Object defaultValue = eFeature.getDefaultValue(); if (defaultValue == null ? newValue == null : defaultValue.equals(newValue)) { featureMap.setting(eFeature).unset(); return; } } featureMap.setting(eFeature).set(newValue); }
if (eFeature instanceof EReference && ((EReference)eFeature).isContainer()) { eSettingDelegate(eFeature).dynamicSet(this, null, -1, newValue); } else { if (!eFeature.isUnsettable()) { Object defaultValue = eFeature.getDefaultValue(); if (defaultValue == null ? newValue == null : defaultValue.equals(newValue)) { featureMap.setting(eFeature).unset(); return; } } featureMap.setting(eFeature).set(newValue); }

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/DelegatingFeatureMap.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicFeatureMap.java
Method name: `void eDynamicSet(EStructuralFeature, Object)` |  | Method name: `void eDynamicSet(EStructuralFeature, Object)`
Number of AST nodes: 8 |  | Number of AST nodes: 8

1

    if (eFeature instanceof EReference && ((EReference)eFeature).isContainer())↵

1

    if (eFeature instanceof EReference && ((EReference)eFeature).isContainer())↵

2

          {↵

2

          {↵

3

            eSettingDelegate(eFeature).dynamicSet(this, null, -1, newValue);↵

3

            eSettingDelegate(eFeature).dynamicSet(this, null, -1, newValue);↵

4

          }↵

4

          }↵

5

          else↵

5

          else↵

6

          {↵

6

          {↵

7

            if (!eFeature.isUnsettable())↵

7

            if (!eFeature.isUnsettable())↵

8

            {↵

8

            {↵

9

              Object defaultValue = eFeature.getDefaultValue();↵

9

              Object defaultValue = eFeature.getDefaultValue();↵

10

              if (defaultValue == null ? newValue == null : defaultValue.equals(newValue))↵

10

              if (defaultValue == null ? newValue == null : defaultValue.equals(newValue))↵

11

              {↵

11

              {↵

12

                featureMap.setting(eFeature).unset();↵

12

                featureMap.setting(eFeature).unset();↵

13

                return;↵

13

                return;↵

14

              }↵

14

              }↵

15

            }↵

15

            }↵

16

            featureMap.setting(eFeature).set(newValue);↵

16

            featureMap.setting(eFeature).set(newValue);↵

17

          }

17

          }

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.7
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 22

1. {Non-refactorable}

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

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

   1

       if (eFeature instanceof EReference && ((EReference)eFeature).isContainer())

   1

       if (eFeature instanceof EReference && ((EReference)eFeature).isContainer())

   2

       eSettingDelegate(eFeature).dynamicSet(this, null, -1, newValue);

   2

       eSettingDelegate(eFeature).dynamicSet(this, null, -1, newValue);

       else

       else

   3

       if (!eFeature.isUnsettable())

   3

       if (!eFeature.isUnsettable())

   4

       Object defaultValue = eFeature.getDefaultValue();

   4

       Object defaultValue = eFeature.getDefaultValue();

   5

       if (defaultValue == null ? newValue == null : defaultValue.equals(newValue))

   5

       if (defaultValue == null ? newValue == null : defaultValue.equals(newValue))

   6

       featureMap.setting(eFeature).unset();

   6 | featureMap.setting(eFeature).unset();
   6 | featureMap.setting(eFeature).unset();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.eclipse.emf.ecore.util.DelegatingFeatureMap | org.eclipse.emf.ecore.util.BasicFeatureMap | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression featureMap cannot be unified with expression featureMap , because common superclass java.util.AbstractList<org.eclipse.emf.ecore.util.FeatureMap.Entry> does not declare member(s) public org.eclipse.emf.ecore.EStructuralFeature.Setting setting(org.eclipse.emf.ecore.EStructuralFeature)

   6

       featureMap.setting(eFeature).unset();

   7

       return;

   7

       return;

   8

       featureMap.setting(eFeature).set(newValue);

   8 | featureMap.setting(eFeature).set(newValue);
   8 | featureMap.setting(eFeature).set(newValue);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.eclipse.emf.ecore.util.DelegatingFeatureMap | org.eclipse.emf.ecore.util.BasicFeatureMap | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression featureMap cannot be unified with expression featureMap , because common superclass java.util.AbstractList<org.eclipse.emf.ecore.util.FeatureMap.Entry> does not declare member(s) public org.eclipse.emf.ecore.EStructuralFeature.Setting setting(org.eclipse.emf.ecore.EStructuralFeature)

   8

       featureMap.setting(eFeature).set(newValue);

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Expression featureMap cannot be unified with expression featureMap , because common superclass java.util.AbstractList<org.eclipse.emf.ecore.util.FeatureMap.Entry> does not declare member(s) public org.eclipse.emf.ecore.EStructuralFeature.Setting setting(org.eclipse.emf.ecore.EStructuralFeature)
   2 | Expression featureMap cannot be unified with expression featureMap , because common superclass java.util.AbstractList<org.eclipse.emf.ecore.util.FeatureMap.Entry> does not declare member(s) public org.eclipse.emf.ecore.EStructuralFeature.Setting setting(org.eclipse.emf.ecore.EStructuralFeature)