173-121-169

if (resources == null) { resources = new ResourcesEList<Resource>(); } return resources;
if (eContents == null) { eContents = EContentsEList.createEContentsEList(this); } return eContents;

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/resource/impl/ResourceSetImpl.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/impl/FlatEObjectImpl.java
Method name: `EList getResources()` |  | Method name: `EList eContents()`
Number of AST nodes: 3 |  | Number of AST nodes: 3

1

    if (resources == null)↵

1

    if (eContents == null)↵

2

        {↵

2

        {↵

3

          resources = new ResourcesEList<Resource>();↵

3

          eContents = EContentsEList.createEContentsEList(this);↵

4

        }↵

4

        }↵

5

        return resources;

5

        return eContents;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 1
Number of non-refactorable cases | 0
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 | 5

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 3
   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) | 58.3
   Clone type | Type 2

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

   1

       if (resources == null)

   1 | if (resources == null)
   1 | if (eContents == null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   resources | eContents | VARIABLE_NAME_MISMATCH

   1

       if (eContents == null)

   2

       resources = new ResourcesEList<Resource>();

   2 | resources = new ResourcesEList<Resource>();
   2 | eContents = EContentsEList.createEContentsEList(this);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   resources | eContents | VARIABLE_NAME_MISMATCH
   org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.ResourcesEList | org.eclipse.emf.ecore.util.EContentsEList | SUBCLASS_TYPE_MISMATCH
   new ResourcesEList() | EContentsEList.createEContentsEList(this) | TYPE_COMPATIBLE_REPLACEMENT

   2

       eContents = EContentsEList.createEContentsEList(this);

   3

       return resources;

   3 | return resources;
   3 | return eContents;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   resources | eContents | VARIABLE_NAME_MISMATCH

   3

       return eContents;

   Precondition Violations (0)
   Row | Violation
   --- | ---