173-57-113

if (gradient == null) { gradient = createGradient(true); } return gradient;
if (leftGradient == null) { getGradients(); } return leftGradient;

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/common/ui/ViewerPane.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/edit/ui/celleditor/AdapterFactoryTableTreeEditor.java
Method name: `Image getGradient(boolean)` |  | Method name: `Image getLeftGradient()`
Number of AST nodes: 3 |  | Number of AST nodes: 3

1

    if (gradient == null)↵

1

    if (leftGradient == null)↵

2

          {↵

2

        ↵

3

      ↵

3

    {↵

4

          gradient = createGradient(true);↵

4

          getGradients();↵

5

          }↵

5

        }↵

6

      ↵

7

        return gradient;

6

        return leftGradient;

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
Number of node comparisons | 5

1. {Non-refactorable}

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

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

   2

       if (gradient == null)

   2 | if (gradient == null)
   1 | if (leftGradient == null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   gradient | leftGradient | VARIABLE_NAME_MISMATCH

   1

       if (leftGradient == null)

   2 | getGradients();

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

   2

       getGradients();

   3

       gradient = createGradient(true);

   3 | gradient = createGradient(true);

   Preondition Violations
   Unmatched statement gradient=createGradient(true); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   4

       return gradient;

   4 | return gradient;
   3 | return leftGradient;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   gradient | leftGradient | VARIABLE_NAME_MISMATCH

   3

       return leftGradient;

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Unmatched statement getGradients(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Unmatched statement gradient=createGradient(true); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted