1689-1-2

if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) { available = area.getWidth(); } else if ((edge == RectangleEdge.LEFT) || (edge == RectangleEdge.RIGHT)) { available = area.getHeight(); }
if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) { available = area.getWidth(); } else if ((edge == RectangleEdge.LEFT) || (edge == RectangleEdge.RIGHT)) { available = area.getHeight(); }

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/CategoryAxis.java
Method name: `double calculateCategorySize(int, Rectangle2D, RectangleEdge)` |  | Method name: `double calculateCategoryGapSize(int, Rectangle2D, RectangleEdge)`
Number of AST nodes: 4 |  | Number of AST nodes: 4

1

    if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {↵

1

    if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {↵

2

                available = area.getWidth();↵

2

                available = area.getWidth();↵

3

            }↵

3

            }↵

4

            else if ((edge == RectangleEdge.LEFT)↵

4

            else if ((edge == RectangleEdge.LEFT)↵

5

                    || (edge == RectangleEdge.RIGHT)) {↵

5

                    || (edge == RectangleEdge.RIGHT)) {↵

6

                available = area.getHeight();↵

6

                available = area.getHeight();↵

7

            }

7

            }

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.8
Clones location | Clones are declared in the same class
Number of node comparisons | 13

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 4
   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) | 0.5
   Clone type | Type 1

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

   3

       if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM))

   3

       if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM))

   4

       available = area.getWidth();

   4

       available = area.getWidth();

   5

       else if ((edge == RectangleEdge.LEFT) || (edge == RectangleEdge.RIGHT))

   5

       else if ((edge == RectangleEdge.LEFT) || (edge == RectangleEdge.RIGHT))

   6

       available = area.getHeight();

   6

       available = area.getHeight();

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