156-1-3

EAnnotation eAnnotation = getAnnotation(eStructuralFeature, false); if (eAnnotation != null) { Object kind = eAnnotation.getDetails().get("kind"); if (kind != null) { for (int i = 1; i < FEATURE_KINDS.length; ++i) { if (FEATURE_KINDS[i].equals(kind)) { return i; } } } } return 0;
EAnnotation eAnnotation = getAnnotation(eStructuralFeature, false); if (eAnnotation != null) { Object kind = eAnnotation.getDetails().get("processing"); if (kind != null) { for (int i = 1; i < PROCESSING_KINDS.length; ++i) { if (PROCESSING_KINDS[i].equals(kind)) { return i; } } } } return 0;

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: `int basicGetFeatureKind(EStructuralFeature)` |  | Method name: `int basicGetProcessingKind(EStructuralFeature)`
Number of AST nodes: 8 |  | Number of AST nodes: 8

1

    EAnnotation eAnnotation = getAnnotation(eStructuralFeature, false);↵

1

    EAnnotation eAnnotation = getAnnotation(eStructuralFeature, false);↵

2

        if (eAnnotation != null)↵

2

        if (eAnnotation != null)↵

3

        {↵

3

        {↵

4

          Object kind = eAnnotation.getDetails().get("kind");↵

4

          Object kind = eAnnotation.getDetails().get("processing");↵

5

          if (kind != null)↵

5

          if (kind != null)↵

6

          {↵

6

          {↵

7

            for (int i = 1; i < FEATURE_KINDS.length; ++i)↵

7

            for (int i = 1; i < PROCESSING_KINDS.length; ++i)↵

8

            {↵

8

            {↵

9

              if (FEATURE_KINDS[i].equals(kind))↵

9

              if (PROCESSING_KINDS[i].equals(kind))↵

10

              {↵

10

              {↵

11

                return i;↵

11

                return i;↵

12

              }↵

12

              }↵

13

            }↵

13

            }↵

14

          }↵

14

          }↵

15

        }↵

15

        }↵

16

        return 0;

16

        return 0;

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) | 1.2
Clones location | Clones are declared in the same class
Number of node comparisons | 14

1. {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) | 2.3
   Clone type | Type 2

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

   1

       EAnnotation eAnnotation = getAnnotation(eStructuralFeature, false);

   1

       EAnnotation eAnnotation = getAnnotation(eStructuralFeature, false);

   2

       if (eAnnotation != null)

   2

       if (eAnnotation != null)

   3

       Object kind = eAnnotation.getDetails().get("kind");

   3 | Object kind = eAnnotation.getDetails().get("kind");
   3 | Object kind = eAnnotation.getDetails().get("processing");

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   "kind" | "processing" | LITERAL_VALUE_MISMATCH

   3

       Object kind = eAnnotation.getDetails().get("processing");

   4

       if (kind != null)

   4

       if (kind != null)

   5

       for (int i = 1; i < FEATURE_KINDS.length; ++i)

   5 | for (int i = 1; i < FEATURE_KINDS.length; ++i)
   5 | for (int i = 1; i < PROCESSING_KINDS.length; ++i)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   FEATURE_KINDS | PROCESSING_KINDS | VARIABLE_NAME_MISMATCH

   5

       for (int i = 1; i < PROCESSING_KINDS.length; ++i)

   6

       if (FEATURE_KINDS[i].equals(kind))

   6 | if (FEATURE_KINDS[i].equals(kind))
   6 | if (PROCESSING_KINDS[i].equals(kind))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   FEATURE_KINDS | PROCESSING_KINDS | VARIABLE_NAME_MISMATCH

   6

       if (PROCESSING_KINDS[i].equals(kind))

   7

       return i;

   7

       return i;

   8

       return 0;

   8

       return 0;

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