229-1-2

if (!isVisible()) { AxisState state = new AxisState(cursor); // even though the axis is not visible, we need to refresh ticks in // case the grid is being drawn... List ticks = refreshTicks(g2, state, dataArea, edge); state.setTicks(ticks); return state; } // draw the tick marks and labels... AxisState state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge); // draw the axis label (note that 'state' is passed in *and* // returned)... state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); return state;
AxisState state = null; // if the axis is not visible, don't draw it... if (!isVisible()) { state = new AxisState(cursor); // even though the axis is not visible, we need ticks for the // gridlines... List ticks = refreshTicks(g2, state, dataArea, edge); state.setTicks(ticks); return state; } // draw the tick marks and labels... state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge); // // draw the marker band (if there is one)... // if (getMarkerBand() != null) { // if (edge == RectangleEdge.BOTTOM) { // cursor = cursor - getMarkerBand().getHeight(g2); // } // getMarkerBand().draw(g2, plotArea, dataArea, 0, cursor); // } // draw the axis label... state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); return state;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/DateAxis.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/NumberAxis.java
Method name: `AxisState draw(Graphics2D, double, Rectangle2D, Rectangle2D, RectangleEdge, PlotRenderingInfo)` |  | Method name: `AxisState draw(Graphics2D, double, Rectangle2D, Rectangle2D, RectangleEdge, PlotRenderingInfo)`
Number of AST nodes: 8 |  | Number of AST nodes: 9

1

    AxisState state = null;↵

2

            // if the axis is not visible, don't draw it...↵

1

    if (!isVisible()) {↵

3

            if (!isVisible()) {↵

2

                AxisState state = new AxisState(cursor);↵

4

                state = new AxisState(cursor);↵

3

                // even though the axis is not visible, we need to refresh ticks in↵

5

                // even though the axis is not visible, we need ticks for the↵

4

                // case the grid is being drawn...↵

6

                // gridlines...↵

5

                List ticks = refreshTicks(g2, state, dataArea, edge);↵

7

                List ticks = refreshTicks(g2, state, dataArea, edge);↵

6

                state.setTicks(ticks);↵

8

                state.setTicks(ticks);↵

7

                return state;↵

9

                return state;↵

8

            }↵

10

            }↵

9

            // draw the tick marks and labels...↵

11

            // draw the tick marks and labels...↵

10

            AxisState state = drawTickMarksAndLabels(g2, cursor, plotArea,↵

12

            state = drawTickMarksAndLabels(g2, cursor, plotArea,↵

11

                    dataArea, edge);↵

13

     dataArea, edge);↵

12

            // draw the axis label (note that 'state' is passed in *and*↵

14

    //        // draw the ↵

13

            // returned)↵

15

    marker band (if there is one)...↵

16

    //        if (getMarkerBand() != null) {↵

17

    //            if (edge == RectangleEdge.BOTTOM) {↵

18

    //                cursor = cursor - getMarkerBand().getHeight(g2);↵

19

    //            }↵

20

    //            getMarkerBand().draw(g2, plotArea, dataArea, 0, cursor);↵

21

    //        }↵

14

    ...↵

22

            // draw the axis label...↵

15

            state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state);↵

23

            state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state);↵

16

            return state;

24

            return state;

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 having the same super class
Number of node comparisons | 31

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 7
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 2
   Time elapsed for statement mapping (ms) | 2.4
   Clone type | Type 3

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

   1

       if (!isVisible())

   2

       if (!isVisible())

   2

       AxisState state = new AxisState(cursor);

   3 | state = new AxisState(cursor);

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

   3

       state = new AxisState(cursor);

   3

       List ticks = refreshTicks(g2, state, dataArea, edge);

   4

       List ticks = refreshTicks(g2, state, dataArea, edge);

   4

       state.setTicks(ticks);

   5

       state.setTicks(ticks);

   5

       return state;

   6

       return state;

   6

       AxisState state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge);

   6 | AxisState state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge);
   1 | AxisState state = null;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   drawTickMarksAndLabels(g2,cursor,plotArea,dataArea,edge) | null | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression drawTickMarksAndLabels(g2,cursor,plotArea,dataArea,edge) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   1

       AxisState state = null;

   7 | state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge);

   Preondition Violations
   Unmatched statement state=drawTickMarksAndLabels(g2,cursor,plotArea,dataArea,edge); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   7

       state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge);

   7

       state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state);

   8

       state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state);

   8

       return state;

   9

       return state;

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Unmatched statement state=new AxisState(cursor); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Expression drawTickMarksAndLabels(g2,cursor,plotArea,dataArea,edge) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Unmatched statement state=drawTickMarksAndLabels(g2,cursor,plotArea,dataArea,edge); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   4 | Clone fragment #1 returns variables , while Clone fragment #2 returns variables state