134-2-3

if (extendedMetaDataHolderCache != null) { EClassifierExtendedMetaData result = (EClassifierExtendedMetaData)extendedMetaDataHolderCache.get(eClassifier); if (result == null) { extendedMetaDataHolderCache.put(eClassifier, result = createEClassifierExtendedMetaData(eClassifier)); } return result; } else { EClassifierExtendedMetaData.Holder holder = (EClassifierExtendedMetaData.Holder)eClassifier; EClassifierExtendedMetaData result = holder.getExtendedMetaData(); if (result == null) { holder.setExtendedMetaData(result = createEClassifierExtendedMetaData(eClassifier)); } return result; }
if (extendedMetaDataHolderCache != null) { EPackageExtendedMetaData result = (EPackageExtendedMetaData)extendedMetaDataHolderCache.get(ePackage); if (result == null) { extendedMetaDataHolderCache.put(ePackage, result = createEPackageExtendedMetaData(ePackage)); } return result; } else { EPackageExtendedMetaData.Holder holder = (EPackageExtendedMetaData.Holder)ePackage; EPackageExtendedMetaData result = holder.getExtendedMetaData(); if (result == null) { holder.setExtendedMetaData(result = createEPackageExtendedMetaData(ePackage)); } return result; }

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicExtendedMetaData.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicExtendedMetaData.java
Method name: `EClassifierExtendedMetaData getExtendedMetaData(EClassifier)` |  | Method name: `EPackageExtendedMetaData getExtendedMetaData(EPackage)`
Number of AST nodes: 10 |  | Number of AST nodes: 10

1

    if (extendedMetaDataHolderCache != null)↵

1

    if (extendedMetaDataHolderCache != null)↵

2

        {↵

2

        {↵

3

          EClassifierExtendedMetaData result = (EClassifierExtendedMetaData)extendedMetaDataHolderCache.get(eClassifier);↵

3

          EPackageExtendedMetaData result = (EPackageExtendedMetaData)extendedMetaDataHolderCache.get(ePackage);↵

4

          if (result == null)↵

4

          if (result == null)↵

5

          {↵

5

          {↵

6

            extendedMetaDataHolderCache.put(eClassifier, result = createEClassifierExtendedMetaData(eClassifier));↵

6

            extendedMetaDataHolderCache.put(ePackage, result = createEPackageExtendedMetaData(ePackage));↵

7

          }↵

7

          }↵

8

          return result;↵

8

          return result;↵

9

        }↵

9

        }↵

10

        else↵

10

        else↵

11

        {↵

11

        {↵

12

          EClassifierExtendedMetaData.Holder holder = (EClassifierExtendedMetaData.Holder)eClassifier;↵

12

          EPackageExtendedMetaData.Holder holder = (EPackageExtendedMetaData.Holder)e↵

13

          EClassifier↵

13

    Package;↵

14

    ExtendedMetaData result = holder.getExtendedMetaData();↵

14

          EPackageExtendedMetaData result = holder.getExtendedMetaData();↵

15

          if (result == null)↵

15

          if (result == null)↵

16

          {↵

16

          {↵

17

            holder.setExtendedMetaData(result = createEClassifierExtendedMetaData(eClassifier));↵

17

            holder.setExtendedMetaData(result = createEPackageExtendedMetaData(ePackage));↵

18

          }↵

18

          }↵

19

          return result;↵

19

          return result;↵

20

        }

20

        }

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.4
Clones location | Clones are declared in the same class
Number of node comparisons | 49

1. {Non-refactorable}

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

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

   1

       if (extendedMetaDataHolderCache != null)

   1

       if (extendedMetaDataHolderCache != null)

   2 | EPackageExtendedMetaData result = (EPackageExtendedMetaData)extendedMetaDataHolderCache.get(ePackage);

   Preondition Violations
   Unmatched statement EPackageExtendedMetaData result=(EPackageExtendedMetaData)extendedMetaDataHolderCache.get(ePackage); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted

   2

       EPackageExtendedMetaData result = (EPackageExtendedMetaData)extendedMetaDataHolderCache.get(ePackage);

   2

       EClassifierExtendedMetaData result = (EClassifierExtendedMetaData)extendedMetaDataHolderCache.get(eClassifier);

   2 | EClassifierExtendedMetaData result = (EClassifierExtendedMetaData)extendedMetaDataHolderCache.get(eClassifier);

   Preondition Violations
   Unmatched statement EClassifierExtendedMetaData result=(EClassifierExtendedMetaData)extendedMetaDataHolderCache.get(eClassifier); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted

   3

       if (result == null)

   3 | if (result == null)
   3 | if (result == null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData | org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData of variable result does not match with type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData of variable result
   - Make classes org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData and org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData extend a common superclass

   3

       if (result == null)

   4

       extendedMetaDataHolderCache.put(eClassifier, result = createEClassifierExtendedMetaData(eClassifier));

   4 | extendedMetaDataHolderCache.put(eClassifier, result = createEClassifierExtendedMetaData(eClassifier));
   4 | extendedMetaDataHolderCache.put(ePackage, result = createEPackageExtendedMetaData(ePackage));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   eClassifier | ePackage | VARIABLE_NAME_MISMATCH
   org.eclipse.emf.ecore.EClassifier | org.eclipse.emf.ecore.EPackage | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.eclipse.emf.ecore.EClassifier of variable eClassifier does not match with type org.eclipse.emf.ecore.EPackage of variable ePackage
   - Make classes org.eclipse.emf.ecore.EClassifier and org.eclipse.emf.ecore.EPackage extend a common superclass

   4

       extendedMetaDataHolderCache.put(ePackage, result = createEPackageExtendedMetaData(ePackage));

   5

       return result;

   5

       return result;

       else

       else

   6

       EPackageExtendedMetaData.Holder holder = (EPackageExtendedMetaData.Holder)ePackage;

   6

       EClassifierExtendedMetaData.Holder holder = (EClassifierExtendedMetaData.Holder)eClassifier;

   7

       EPackageExtendedMetaData result = holder.getExtendedMetaData();

   7

       EClassifierExtendedMetaData result = holder.getExtendedMetaData();

   8

       if (result == null)

   8 | if (result == null)
   8 | if (result == null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData | org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData of variable result does not match with type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData of variable result
   - Make classes org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData and org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData extend a common superclass

   8

       if (result == null)

   9

       holder.setExtendedMetaData(result = createEClassifierExtendedMetaData(eClassifier));

   9 | holder.setExtendedMetaData(result = createEClassifierExtendedMetaData(eClassifier));
   9 | holder.setExtendedMetaData(result = createEPackageExtendedMetaData(ePackage));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData | org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData | VARIABLE_TYPE_MISMATCH
   org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData.Holder | org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData.Holder | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData of variable result does not match with type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData of variable result
   - Make classes org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData and org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData extend a common superclass

   Type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData.Holder of variable holder does not match with type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData.Holder of variable holder
   - Make classes org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData.Holder and org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData.Holder extend a common superclass

   9

       holder.setExtendedMetaData(result = createEPackageExtendedMetaData(ePackage));

   10

       return result;

   10

       return result;

   Precondition Violations (8)
   Row | Violation
   --- | ---
   1 | Unmatched statement EPackageExtendedMetaData result=(EPackageExtendedMetaData)extendedMetaDataHolderCache.get(ePackage); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
   2 | Unmatched statement EClassifierExtendedMetaData result=(EClassifierExtendedMetaData)extendedMetaDataHolderCache.get(eClassifier); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
   3 | Type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData of variable result does not match with type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData of variable result
   4 | Type org.eclipse.emf.ecore.EClassifier of variable eClassifier does not match with type org.eclipse.emf.ecore.EPackage of variable ePackage
   5 | Type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData of variable result does not match with type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData of variable result
   6 | Type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData of variable result does not match with type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData of variable result
   7 | Type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData.Holder of variable holder does not match with type org.eclipse.emf.ecore.util.BasicExtendedMetaData.EPackageExtendedMetaData.Holder of variable holder
   8 | Clone fragment #1 returns variables result, result , while Clone fragment #2 returns variables result, result