146-1-2

float xx = (float) valueToJava2D(tick.getValue(), dataArea, edge); Line2D mark = null; g2.setStroke(getTickMarkStroke()); g2.setPaint(getTickMarkPaint()); if (edge == RectangleEdge.LEFT) { mark = new Line2D.Double(cursor - ol, xx, cursor + il, xx); } else if (edge == RectangleEdge.RIGHT) { mark = new Line2D.Double(cursor + ol, xx, cursor - il, xx); } else if (edge == RectangleEdge.TOP) { mark = new Line2D.Double(xx, cursor - ol, xx, cursor + il); } else if (edge == RectangleEdge.BOTTOM) { mark = new Line2D.Double(xx, cursor + ol, xx, cursor - il); } g2.draw(mark);
if (isTickMarksVisible()) { float xx = (float) valueToJava2D( getRange().getUpperBound(), dataArea, edge ); Line2D mark = null; g2.setStroke(getTickMarkStroke()); g2.setPaint(getTickMarkPaint()); if (edge == RectangleEdge.LEFT) { mark = new Line2D.Double(cursor - ol, xx, cursor + il, xx); } else if (edge == RectangleEdge.RIGHT) { mark = new Line2D.Double(cursor + ol, xx, cursor - il, xx); } else if (edge == RectangleEdge.TOP) { mark = new Line2D.Double(xx, cursor - ol, xx, cursor + il); } else if (edge == RectangleEdge.BOTTOM) { mark = new Line2D.Double(xx, cursor + ol, xx, cursor - il); } g2.draw(mark); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/ValueAxis.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/CyclicNumberAxis.java
Method name: `AxisState drawTickMarksAndLabels(Graphics2D, double, Rectangle2D, Rectangle2D, RectangleEdge)` |  | Method name: `AxisState drawTickMarksAndLabels(Graphics2D, double, Rectangle2D, Rectangle2D, RectangleEdge)`
Number of AST nodes: 13 |  | Number of AST nodes: 14

1

    float xx = (float) valueToJava2D(tick.getValue↵

1

    if (isTickMarksVisible()) {↵

2

                float xx = (float) valueToJava2D(↵

2

    (), dataArea,↵

3

                    getRange().getUpperBound(), dataArea, edge↵

3

                            edge);↵

4

                ↵

4

        ↵

5

    );↵

5

                Line2D mark = null;↵

6

                Line2D mark = null;↵

6

                    g2.setStroke(getTickMarkStroke());↵

7

                g2.setStroke(getTickMarkStroke());↵

7

                    g2.setPaint(getTickMarkPaint());↵

8

                g2.setPaint(getTickMarkPaint());↵

8

                    if (edge == RectangleEdge.LEFT) {↵

9

                if (edge == RectangleEdge.LEFT) {↵

9

                        mark = new Line2D.Double(cursor - ol, xx, cursor + il, xx);↵

10

                    mark = new Line2D.Double(cursor - ol, xx, cursor + il, xx);↵

10

                    }↵

11

                ↵

11

        ↵

12

    }↵

12

                else if (edge == RectangleEdge.RIGHT) {↵

13

                else if (edge == RectangleEdge.RIGHT) {↵

13

                        mark = new Line2D.Double(cursor + ol, xx, cursor - il, xx);↵

14

                    mark = new Line2D.Double(cursor + ol, xx, cursor - il, xx);↵

14

                    }↵

15

                ↵

15

        ↵

16

    }↵

16

                else if (edge == RectangleEdge.TOP) {↵

17

                else if (edge == RectangleEdge.TOP) {↵

17

                        mark = new Line2D.Double(xx, cursor - ol, xx, cursor + il);↵

18

                    mark = new Line2D.Double(xx, cursor - ol, xx, cursor + il);↵

18

                    }↵

19

                ↵

19

        ↵

20

    }↵

20

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

21

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

21

                        mark = new Line2D.Double(xx, cursor + ol, xx, cursor - il);↵

22

                    mark = new Line2D.Double(xx, cursor + ol, xx, cursor - il);↵

22

                    }↵

23

                ↵

23

        ↵

24

    }↵

24

                g2.draw(mark);

25

                g2.draw(mark);↵

26

            }

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) | 1.2
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 72

1. {Non-refactorable}

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

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

   12

       float xx = (float)valueToJava2D(getRange().getUpperBound(), dataArea, edge);

   17

       float xx = (float)valueToJava2D(tick.getValue(), dataArea, edge);

   17 | float xx = (float)valueToJava2D(tick.getValue(), dataArea, edge);

   Preondition Violations
   Unmatched statement float xx=(float)valueToJava2D(tick.getValue(),dataArea,edge); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   18

       Line2D mark = null;

   13

       Line2D mark = null;

   19

       g2.setStroke(getTickMarkStroke());

   14

       g2.setStroke(getTickMarkStroke());

   20

       g2.setPaint(getTickMarkPaint());

   15

       g2.setPaint(getTickMarkPaint());

   21

       if (edge == RectangleEdge.LEFT)

   16

       if (edge == RectangleEdge.LEFT)

   22

       mark = new Line2D.Double(cursor - ol, xx, cursor + il, xx);

   17

       mark = new Line2D.Double(cursor - ol, xx, cursor + il, xx);

   23

       else if (edge == RectangleEdge.RIGHT)

   18

       else if (edge == RectangleEdge.RIGHT)

   24

       mark = new Line2D.Double(cursor + ol, xx, cursor - il, xx);

   19

       mark = new Line2D.Double(cursor + ol, xx, cursor - il, xx);

   25

       else if (edge == RectangleEdge.TOP)

   20

       else if (edge == RectangleEdge.TOP)

   26

       mark = new Line2D.Double(xx, cursor - ol, xx, cursor + il);

   21

       mark = new Line2D.Double(xx, cursor - ol, xx, cursor + il);

   27

       else if (edge == RectangleEdge.BOTTOM)

   22

       else if (edge == RectangleEdge.BOTTOM)

   28

       mark = new Line2D.Double(xx, cursor + ol, xx, cursor - il);

   23

       mark = new Line2D.Double(xx, cursor + ol, xx, cursor - il);

   29

       g2.draw(mark);

   24

       g2.draw(mark);

   Precondition Violations (1)
   Row | Violation
   --- | ---
   1 | Unmatched statement float xx=(float)valueToJava2D(tick.getValue(),dataArea,edge); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted