141-1-2

if (isHandlingFeatureMap) { while (values.hasPrevious()) { FeatureMap.Entry entry = (FeatureMap.Entry)values.previous(); EStructuralFeature entryFeature = entry.getEStructuralFeature(); if (isIncludedEntry(entryFeature) && entry.getValue() != null) { values.next(); return true; } } return false; } else { return values.hasPrevious(); }
if (isHandlingFeatureMap) { while (values.hasNext()) { FeatureMap.Entry entry = (FeatureMap.Entry)values.next(); EStructuralFeature entryFeature = entry.getEStructuralFeature(); if (isIncludedEntry(entryFeature) && entry.getValue() != null) { values.previous(); return true; } } return false; } else { return values.hasNext(); }

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/EContentsEList.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/EContentsEList.java
Method name: `boolean scanPrevious(ListIterator)` |  | Method name: `boolean scanNext(ListIterator)`
Number of AST nodes: 9 |  | Number of AST nodes: 9

1

    if (isHandlingFeatureMap)↵

1

    if (isHandlingFeatureMap)↵

2

          {↵

2

          {↵

3

            while (values.hasPrevious())↵

3

            while (values.hasNext())↵

4

            {↵

4

            {↵

5

              FeatureMap.Entry entry = (FeatureMap.Entry)values.previous();↵

5

              FeatureMap.Entry entry = (FeatureMap.Entry)values.next();↵

6

              EStructuralFeature entryFeature = entry.getEStructuralFeature();↵

6

              EStructuralFeature entryFeature = entry.getEStructuralFeature();↵

7

              if (isIncludedEntry(entryFeature) && entry.getValue() != null)↵

7

              if (isIncludedEntry(entryFeature) && entry.getValue() != null)↵

8

              {↵

8

              {↵

9

                values.next();↵

9

                values.previous();↵

10

                return true;↵

10

                return true;↵

11

              }↵

11

              }↵

12

            }↵

12

            }↵

13

            return false;↵

13

            return false;↵

14

          }↵

14

          }↵

15

          else↵

15

          else↵

16

          {↵

16

          {↵

17

            return values.hasPrevious();↵

17

            return values.hasNext();↵

18

          }

18

          }

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

1. {Non-refactorable}

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

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

   1

       if (isHandlingFeatureMap)

   1

       if (isHandlingFeatureMap)

   2

       while (values.hasPrevious())

   2 | while (values.hasPrevious())
   2 | while (values.hasNext())

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   hasPrevious | hasNext | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression values.hasPrevious() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression values.hasNext() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   2

       while (values.hasNext())

   3

       FeatureMap.Entry entry = (FeatureMap.Entry)values.previous();

   3 | FeatureMap.Entry entry = (FeatureMap.Entry)values.previous();
   3 | FeatureMap.Entry entry = (FeatureMap.Entry)values.next();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   previous | next | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression values.previous() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression values.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   3

       FeatureMap.Entry entry = (FeatureMap.Entry)values.next();

   4

       EStructuralFeature entryFeature = entry.getEStructuralFeature();

   4

       EStructuralFeature entryFeature = entry.getEStructuralFeature();

   5

       if (isIncludedEntry(entryFeature) && entry.getValue() != null)

   5

       if (isIncludedEntry(entryFeature) && entry.getValue() != null)

   6 | values.previous();

   Preondition Violations
   Unmatched statement values.previous(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   6

       values.previous();

   6

       values.next();

   6 | values.next();

   Preondition Violations
   Unmatched statement values.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   7

       return true;

   7

       return true;

   8

       return false;

   8

       return false;

       else

       else

   9

       return values.hasPrevious();

   9 | return values.hasPrevious();
   9 | return values.hasNext();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   hasPrevious | hasNext | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression values.hasPrevious() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression values.hasNext() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   9

       return values.hasNext();

   Precondition Violations (9)
   Row | Violation
   --- | ---
   1 | Expression values.hasPrevious() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression values.hasNext() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression values.previous() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression values.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Unmatched statement values.previous(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   6 | Unmatched statement values.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   7 | Expression values.hasPrevious() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   8 | Expression values.hasNext() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   9 | Not all possible execution flows end in a return statement