1578-1-2

if (RectangleEdge.isTopOrBottom(edge)) { labelHeight = labelEnclosure.getHeight(); space.add(labelHeight + tickLabelBandsDimension, edge); } else if (RectangleEdge.isLeftOrRight(edge)) { labelWidth = labelEnclosure.getWidth(); space.add(labelWidth + tickLabelBandsDimension, edge); }
if (RectangleEdge.isTopOrBottom(edge)) { labelHeight = labelEnclosure.getHeight(); space.add(labelHeight + tickLabelHeight, edge); } else if (RectangleEdge.isLeftOrRight(edge)) { labelWidth = labelEnclosure.getWidth(); space.add(labelWidth + tickLabelWidth, edge); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/PeriodAxis.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/ValueAxis.java
Method name: `AxisSpace reserveSpace(Graphics2D, Plot, Rectangle2D, RectangleEdge, AxisSpace)` |  | Method name: `AxisSpace reserveSpace(Graphics2D, Plot, Rectangle2D, RectangleEdge, AxisSpace)`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

    if (RectangleEdge.isTopOrBottom(edge)) {↵

1

    if (RectangleEdge.isTopOrBottom(edge)) {↵

2

                labelHeight = labelEnclosure.getHeight();↵

2

                labelHeight = labelEnclosure.getHeight();↵

3

                space.add(labelHeight + tickLabelBandsDimension, edge);↵

3

                space.add(labelHeight + tickLabelHeight, edge);↵

4

            }↵

4

            }↵

5

            else if (RectangleEdge.isLeftOrRight(edge)) {↵

5

            else if (RectangleEdge.isLeftOrRight(edge)) {↵

6

                labelWidth = labelEnclosure.getWidth();↵

6

                labelWidth = labelEnclosure.getWidth();↵

7

                space.add(labelWidth + tickLabelBandsDimension, edge);↵

7

                space.add(labelWidth + tickLabelWidth, edge);↵

8

            }

8

            }

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

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) | 3.5
   Clone type | Type 2

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

   16

       if (RectangleEdge.isTopOrBottom(edge))

   20

       if (RectangleEdge.isTopOrBottom(edge))

   17

       labelHeight = labelEnclosure.getHeight();

   21

       labelHeight = labelEnclosure.getHeight();

   18

       space.add(labelHeight + tickLabelBandsDimension, edge);

   18 | space.add(labelHeight + tickLabelBandsDimension, edge);
   22 | space.add(labelHeight + tickLabelHeight, edge);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   tickLabelBandsDimension | tickLabelHeight | VARIABLE_NAME_MISMATCH

   22

       space.add(labelHeight + tickLabelHeight, edge);

   19

       else if (RectangleEdge.isLeftOrRight(edge))

   23

       else if (RectangleEdge.isLeftOrRight(edge))

   20

       labelWidth = labelEnclosure.getWidth();

   24

       labelWidth = labelEnclosure.getWidth();

   21

       space.add(labelWidth + tickLabelBandsDimension, edge);

   21 | space.add(labelWidth + tickLabelBandsDimension, edge);
   25 | space.add(labelWidth + tickLabelWidth, edge);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   tickLabelBandsDimension | tickLabelWidth | VARIABLE_NAME_MISMATCH

   25

       space.add(labelWidth + tickLabelWidth, edge);

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