161-1-2

if (isInited) return (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); // Obtain or create and register package XMLTypePackageImpl theXMLTypePackage = (XMLTypePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof XMLTypePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new XMLTypePackageImpl()); isInited = true; // Create package meta-data objects theXMLTypePackage.createPackageContents(); // Initialize created meta-data theXMLTypePackage.initializePackageContents(); // Register package validator EValidator.Registry.INSTANCE.put (theXMLTypePackage, new EValidator.Descriptor() { public EValidator getEValidator() { return XMLTypeValidator.INSTANCE; } }); // Mark meta-data to indicate it can't be changed theXMLTypePackage.freeze(); return theXMLTypePackage;
if (isInited) return (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI); // Obtain or create and register package EcorePackageImpl theEcorePackage = (EcorePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof EcorePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new EcorePackageImpl()); isInited = true; // Create package meta-data objects theEcorePackage.createPackageContents(); // Initialize created meta-data theEcorePackage.initializePackageContents(); // Register package validator EValidator.Registry.INSTANCE.put (theEcorePackage, new EValidator.Descriptor() { public EValidator getEValidator() { return EcoreValidator.INSTANCE; } }); return theEcorePackage;

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/impl/XMLTypePackageImpl.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/impl/EcorePackageImpl.java
Method name: `XMLTypePackage init()` |  | Method name: `EcorePackage init()`
Number of AST nodes: 9 |  | Number of AST nodes: 8

1

    if (isInited) return (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI);↵

1

    if (isInited) return (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);↵

2

        // Obtain or create and register package↵

2

        // Obtain or create and register package↵

3

        XMLTypePackageImpl theXMLTypePackage = (XMLTypePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof XMLTypePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new XMLTypePackageImpl());↵

3

        EcorePackageImpl theEcorePackage = (EcorePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof EcorePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new EcorePackageImpl());↵

4

        isInited = true;↵

4

        isInited = true;↵

5

        // Create package meta-data objects↵

5

        // Create package meta-data objects↵

6

        theXMLTypePackage.createPackageContents();↵

6

        theEcorePackage.createPackageContents();↵

7

        // Initialize created meta-data↵

7

        // Initialize created meta-data↵

8

        theXMLTypePackage.initializePackageContents();↵

8

        theEcorePackage.initializePackageContents();↵

9

        // Register package validator↵

9

        // Register package validator↵

10

        EValidator.Registry.INSTANCE.put↵

10

        EValidator.Registry.INSTANCE.put↵

11

          (theXMLTypePackage, ↵

11

          (theEcorePackage, ↵

12

           new EValidator.Descriptor()↵

12

           new EValidator.Descriptor()↵

13

           {↵

13

           {↵

14

             public EValidator getEValidator()↵

14

             public EValidator getEValidator()↵

15

             {↵

15

             {↵

16

               return XMLTypeValidator.INSTANCE;↵

16

               return EcoreValidator.INSTANCE;↵

17

             }↵

17

             }↵

18

           });↵

18

           });↵

19

        // Mark meta-data to indicate it can't be changed↵

19

        ↵

20

        theXMLTypePackage.freeze();↵

21

        return theXMLTypePackage;

20

    return theEcorePackage;

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 | 27

1. {Non-refactorable}

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

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

   1

       if (isInited)

   1

       if (isInited)

   2 | return (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);

   Preondition Violations
   Unmatched return (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);

   2

       return (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);

   2

       return (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI);

   2 | return (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI);

   Preondition Violations
   Unmatched return (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI);

   3

       XMLTypePackageImpl theXMLTypePackage = (XMLTypePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof XMLTypePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new XMLTypePackageImpl());

   3 | XMLTypePackageImpl theXMLTypePackage = (XMLTypePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof XMLTypePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new XMLTypePackageImpl());
   3 | EcorePackageImpl theEcorePackage = (EcorePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof EcorePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new EcorePackageImpl());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl | org.eclipse.emf.ecore.impl.EcorePackageImpl | SUBCLASS_TYPE_MISMATCH
   theXMLTypePackage | theEcorePackage | VARIABLE_NAME_MISMATCH
   org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl | org.eclipse.emf.ecore.impl.EcorePackageImpl | SUBCLASS_TYPE_MISMATCH
   org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl | org.eclipse.emf.ecore.impl.EcorePackageImpl | SUBCLASS_TYPE_MISMATCH
   org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl | org.eclipse.emf.ecore.impl.EcorePackageImpl | SUBCLASS_TYPE_MISMATCH
   org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl | org.eclipse.emf.ecore.impl.EcorePackageImpl | SUBCLASS_TYPE_MISMATCH

   3

       EcorePackageImpl theEcorePackage = (EcorePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof EcorePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new EcorePackageImpl());

   4

       isInited = true;

   4

       isInited = true;

   5

       theXMLTypePackage.createPackageContents();

   5 | theXMLTypePackage.createPackageContents();
   5 | theEcorePackage.createPackageContents();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   theXMLTypePackage | theEcorePackage | VARIABLE_NAME_MISMATCH
   org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl | org.eclipse.emf.ecore.impl.EcorePackageImpl | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression theXMLTypePackage cannot be unified with expression theEcorePackage , because common superclass org.eclipse.emf.ecore.impl.EPackageImpl does not declare member(s) public void createPackageContents()

   5

       theEcorePackage.createPackageContents();

   6

       theXMLTypePackage.initializePackageContents();

   6 | theXMLTypePackage.initializePackageContents();
   6 | theEcorePackage.initializePackageContents();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   theXMLTypePackage | theEcorePackage | VARIABLE_NAME_MISMATCH
   org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl | org.eclipse.emf.ecore.impl.EcorePackageImpl | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression theXMLTypePackage cannot be unified with expression theEcorePackage , because common superclass org.eclipse.emf.ecore.impl.EPackageImpl does not declare member(s) public void initializePackageContents()

   6

       theEcorePackage.initializePackageContents();

   7

       EValidator.Registry.INSTANCE.put(theXMLTypePackage, new EValidator.Descriptor() {...});

   7 | EValidator.Registry.INSTANCE.put(theXMLTypePackage, new EValidator.Descriptor() {...});
   7 | EValidator.Registry.INSTANCE.put(theEcorePackage, new EValidator.Descriptor() {...});

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   theXMLTypePackage | theEcorePackage | VARIABLE_NAME_MISMATCH
   org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl | org.eclipse.emf.ecore.impl.EcorePackageImpl | SUBCLASS_TYPE_MISMATCH
   org.eclipse.emf.ecore.xml.type.util.XMLTypeValidator | org.eclipse.emf.ecore.util.EcoreValidator | SUBCLASS_TYPE_MISMATCH

   7

       EValidator.Registry.INSTANCE.put(theEcorePackage, new EValidator.Descriptor() {...});

   8

       theXMLTypePackage.freeze();

   9

       return theXMLTypePackage;

   9 | return theXMLTypePackage;
   8 | return theEcorePackage;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   theXMLTypePackage | theEcorePackage | VARIABLE_NAME_MISMATCH
   org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl | org.eclipse.emf.ecore.impl.EcorePackageImpl | SUBCLASS_TYPE_MISMATCH

   8

       return theEcorePackage;

   Precondition Violations (5)
   Row | Violation
   --- | ---
   1 | Unmatched return (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
   2 | Unmatched return (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI);
   3 | Expression theXMLTypePackage cannot be unified with expression theEcorePackage , because common superclass org.eclipse.emf.ecore.impl.EPackageImpl does not declare member(s) public void createPackageContents()
   4 | Expression theXMLTypePackage cannot be unified with expression theEcorePackage , because common superclass org.eclipse.emf.ecore.impl.EPackageImpl does not declare member(s) public void initializePackageContents()
   5 | Clone fragment #1 returns variables theXMLTypePackage , while Clone fragment #2 returns variables