1089-1-2

if (anchor == CategoryAnchor.START) { result = getCategoryStart(category, categoryCount, area, edge); } else if (anchor == CategoryAnchor.MIDDLE) { result = getCategoryMiddle(category, categoryCount, area, edge); } else if (anchor == CategoryAnchor.END) { result = getCategoryEnd(category, categoryCount, area, edge); }
if (anchor == CategoryAnchor.START) { result = getCategoryStart(category, categoryCount, adjustedArea, edge); } else if (anchor == CategoryAnchor.MIDDLE) { result = getCategoryMiddle(category, categoryCount, adjustedArea, edge); } else if (anchor == CategoryAnchor.END) { result = getCategoryEnd(category, categoryCount, adjustedArea, edge); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/CategoryAxis.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/CategoryAxis3D.java
Method name: `double getCategoryJava2DCoordinate(CategoryAnchor, int, int, Rectangle2D, RectangleEdge)` |  | Method name: `double getCategoryJava2DCoordinate(CategoryAnchor, int, int, Rectangle2D, RectangleEdge)`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

    if (anchor == CategoryAnchor.START) {↵

1

    if (anchor == CategoryAnchor.START) {↵

2

                result = getCategoryStart(category, categoryCount, area,↵

2

                result = getCategoryStart(category, categoryCount, adjustedArea, ↵

3

     edge);↵

3

                        edge);↵

4

            }↵

4

            }↵

5

            else if (anchor == CategoryAnchor.MIDDLE) {↵

5

            else if (anchor == CategoryAnchor.MIDDLE) {↵

6

                result = getCategoryMiddle(category, categoryCount, area,↵

6

                result = getCategoryMiddle(category, categoryCount, adjustedArea, ↵

7

     edge);↵

7

                        edge);↵

8

            }↵

8

            }↵

9

            else if (anchor == CategoryAnchor.END) {↵

9

            else if (anchor == CategoryAnchor.END) {↵

10

                result = getCategoryEnd(category, categoryCount, area,↵

10

                result = getCategoryEnd(category, categoryCount, adjustedArea, ↵

11

     edge);↵

11

                        edge);↵

12

            }

12

            }

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.6
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 27

1. {Refactorable}

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

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

   2

       if (anchor == CategoryAnchor.START)

   16

       if (anchor == CategoryAnchor.START)

   3

       result = getCategoryStart(category, categoryCount, area, edge);

   3 | result = getCategoryStart(category, categoryCount, area, edge);
   17 | result = getCategoryStart(category, categoryCount, adjustedArea, edge);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   area | adjustedArea | VARIABLE_NAME_MISMATCH

   17

       result = getCategoryStart(category, categoryCount, adjustedArea, edge);

   4

       else if (anchor == CategoryAnchor.MIDDLE)

   18

       else if (anchor == CategoryAnchor.MIDDLE)

   5

       result = getCategoryMiddle(category, categoryCount, area, edge);

   5 | result = getCategoryMiddle(category, categoryCount, area, edge);
   19 | result = getCategoryMiddle(category, categoryCount, adjustedArea, edge);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   area | adjustedArea | VARIABLE_NAME_MISMATCH

   19

       result = getCategoryMiddle(category, categoryCount, adjustedArea, edge);

   6

       else if (anchor == CategoryAnchor.END)

   20

       else if (anchor == CategoryAnchor.END)

   7

       result = getCategoryEnd(category, categoryCount, area, edge);

   7 | result = getCategoryEnd(category, categoryCount, area, edge);
   21 | result = getCategoryEnd(category, categoryCount, adjustedArea, edge);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   area | adjustedArea | VARIABLE_NAME_MISMATCH

   21

       result = getCategoryEnd(category, categoryCount, adjustedArea, edge);

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