150-1-2

if (object instanceof List) { List<?> list = (List<?>)object; if (list.size() == delegateSize()) { for (Iterator<?> i = list.iterator(), j = iterator(); i.hasNext(); ) { if (i.next() != j.next()) { return false; } } return true; } } return false;
if (object instanceof List) { List<?> list = (List<?>)object; if (list.size() == delegateSize()) { for (Iterator<?> i = list.iterator(), j = iterator(); i.hasNext(); ) { if (i.next() != j.next()) { return false; } } return true; } } return false;

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/impl/EClassImpl.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/impl/EOperationImpl.java
Method name: `boolean delegateEquals(Object)` |  | Method name: `boolean delegateEquals(Object)`
Number of AST nodes: 8 |  | Number of AST nodes: 8

1

    if (object instanceof List)↵

1

    if (object instanceof List)↵

2

                {↵

2

                {↵

3

                  List<?> list = (List<?>)object;↵

3

                  List<?> list = (List<?>)object;↵

4

                  if (list.size() == delegateSize())↵

4

                  if (list.size() == delegateSize())↵

5

                  {↵

5

                  {↵

6

                    for (Iterator<?> i = list.iterator(), j = iterator(); i.hasNext(); )↵

6

                    for (Iterator<?> i = list.iterator(), j = iterator(); i.hasNext(); )↵

7

                    {↵

7

                    {↵

8

                      if (i.next() != j.next())↵

8

                      if (i.next() != j.next())↵

9

                      {↵

9

                      {↵

10

                        return false;↵

10

                        return false;↵

11

                      }↵

11

                      }↵

12

                    }↵

12

                    }↵

13

                    return true;↵

13

                    return true;↵

14

                  }↵

14

                  }↵

15

                }↵

15

                }↵

16

                return false;

16

                return false;

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

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) | 57.5
   Clone type | Type 1

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

   1

       if (object instanceof List)

   1

       if (object instanceof List)

   2

       List<?> list = (List<?>)object;

   2

       List<?> list = (List<?>)object;

   3

       if (list.size() == delegateSize())

   3

       if (list.size() == delegateSize())

   4

       for (Iterator<?> i = list.iterator(), j = iterator(); i.hasNext(); )

   4

       for (Iterator<?> i = list.iterator(), j = iterator(); i.hasNext(); )

   5

       if (i.next() != j.next())

   5

       if (i.next() != j.next())

   6

       return false;

   6

       return false;

   7

       return true;

   7

       return true;

   8

       return false;

   8

       return false;

   Precondition Violations (1)
   Row | Violation
   --- | ---
   1 | The refactoring of the clones is infeasible, because classes and do not have a common superclass