307-1-2

if (!axis.getRange().contains(value)) { return; } Line2D line = null; if (orientation == PlotOrientation.HORIZONTAL) { double xx = axis.valueToJava2D(value, dataArea, RectangleEdge.BOTTOM); line = new Line2D.Double(xx, dataArea.getMinY(), xx, dataArea.getMaxY()); } else { double yy = axis.valueToJava2D(value, dataArea, RectangleEdge.LEFT); line = new Line2D.Double(dataArea.getMinX(), yy, dataArea.getMaxX(), yy); } g2.setStroke(stroke); g2.setPaint(paint); g2.draw(line);
if (axis.getRange().contains(value)) { Line2D line = null; if (orientation == PlotOrientation.VERTICAL) { double xx = axis.valueToJava2D(value, dataArea, RectangleEdge.BOTTOM); line = new Line2D.Double(xx, dataArea.getMinY(), xx, dataArea.getMaxY()); } else { double yy = axis.valueToJava2D(value, dataArea, RectangleEdge.LEFT); line = new Line2D.Double(dataArea.getMinX(), yy, dataArea.getMaxX(), yy); } g2.setStroke(stroke); g2.setPaint(paint); g2.draw(line); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CategoryPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java
Method name: `void drawRangeCrosshair(Graphics2D, Rectangle2D, PlotOrientation, double, ValueAxis, Stroke, Paint)` |  | Method name: `void drawDomainCrosshair(Graphics2D, Rectangle2D, PlotOrientation, double, ValueAxis, Stroke, Paint)`
Number of AST nodes: 11 |  | Number of AST nodes: 10

1

    if (!axis.getRange().contains(value)) {↵

1

    if (axis.getRange().contains(value)) {↵

2

                return;↵

2

        ↵

3

            }↵

4

            Line2D line = null;↵

3

            Line2D line = null;↵

5

            if (orientation == PlotOrientation.HORIZONTAL) {↵

4

                if (orientation == PlotOrientation.VERTICAL) {↵

6

                double xx = axis.valueToJava2D(value, dataArea,↵

5

                    double xx = axis.valueToJava2D(value, dataArea,↵

7

                        RectangleEdge.BOTTOM);↵

6

                            RectangleEdge.BOTTOM);↵

8

                line = new Line2D.Double(xx, dataArea.getMinY(), xx,↵

7

                    line = new Line2D.Double(xx, dataArea.getMinY(), xx,↵

9

                        dataArea.getMaxY());↵

8

                            dataArea.getMaxY());↵

10

            }↵

9

                }↵

11

            else {↵

10

                else {↵

12

                double yy = axis.valueToJava2D(value, dataArea,↵

11

                    double yy = axis.valueToJava2D(value, dataArea,↵

13

                        RectangleEdge.LEFT);↵

12

                            RectangleEdge.LEFT);↵

14

                line = new Line2D.Double(dataArea.getMinX(), yy,↵

13

                    line = new Line2D.Double(dataArea.getMinX(), yy,↵

15

                        dataArea.getMaxX(), yy);↵

14

                            dataArea.getMaxX(), yy);↵

16

            }↵

15

            ↵

16

        }↵

17

            g2.setStroke(stroke);↵

17

                g2.setStroke(stroke);↵

18

            g2.setPaint(paint);↵

18

                g2.setPaint(paint);↵

19

            g2.draw(line);

19

                g2.draw(line);↵

20

            }

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

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

   3

       Line2D line = null;

   2

       Line2D line = null;

   4

       if (orientation == PlotOrientation.HORIZONTAL)

   4 | if (orientation == PlotOrientation.HORIZONTAL)
   3 | if (orientation == PlotOrientation.VERTICAL)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   HORIZONTAL | VERTICAL | VARIABLE_NAME_MISMATCH

   3

       if (orientation == PlotOrientation.VERTICAL)

   5

       double xx = axis.valueToJava2D(value, dataArea, RectangleEdge.BOTTOM);

   4

       double xx = axis.valueToJava2D(value, dataArea, RectangleEdge.BOTTOM);

   6

       line = new Line2D.Double(xx, dataArea.getMinY(), xx, dataArea.getMaxY());

   5

       line = new Line2D.Double(xx, dataArea.getMinY(), xx, dataArea.getMaxY());

       else

       else

   7

       double yy = axis.valueToJava2D(value, dataArea, RectangleEdge.LEFT);

   6

       double yy = axis.valueToJava2D(value, dataArea, RectangleEdge.LEFT);

   8

       line = new Line2D.Double(dataArea.getMinX(), yy, dataArea.getMaxX(), yy);

   7

       line = new Line2D.Double(dataArea.getMinX(), yy, dataArea.getMaxX(), yy);

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