283-1-2

ValueAxis axis = getRangeAxis(); if (getOrientation() == PlotOrientation.HORIZONTAL) { axis = getDomainAxis(); } if (axis.getRange().contains(value)) { double yy = axis.valueToJava2D(value, dataArea, RectangleEdge.LEFT); Line2D line = new Line2D.Double(dataArea.getMinX(), yy, dataArea.getMaxX(), yy); g2.setStroke(stroke); g2.setPaint(paint); g2.draw(line); }
ValueAxis axis = getDomainAxis(); if (getOrientation() == PlotOrientation.HORIZONTAL) { axis = getRangeAxis(); } if (axis.getRange().contains(value)) { double xx = axis.valueToJava2D(value, dataArea, RectangleEdge.BOTTOM); Line2D line = new Line2D.Double(xx, dataArea.getMinY(), xx, dataArea.getMaxY()); 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/XYPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java
Method name: `void drawHorizontalLine(Graphics2D, Rectangle2D, double, Stroke, Paint)` |  | Method name: `void drawVerticalLine(Graphics2D, Rectangle2D, double, Stroke, Paint)`
Number of AST nodes: 9 |  | Number of AST nodes: 9

1

    ValueAxis axis = getRangeAxis();↵

1

    ValueAxis axis = getDomainAxis();↵

2

            if (getOrientation() == PlotOrientation.HORIZONTAL) {↵

2

            if (getOrientation() == PlotOrientation.HORIZONTAL) {↵

3

                axis = getDomainAxis();↵

3

                axis = getRangeAxis();↵

4

            }↵

4

            }↵

5

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

5

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

6

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

6

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

7

     RectangleEdge.LEFT);↵

7

                        RectangleEdge.BOTTOM);↵

8

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

8

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

9

                        dataArea.getMaxX(), yy);↵

9

                        dataArea.getMaxY());↵

10

                g2.setStroke(stroke);↵

10

                g2.setStroke(stroke);↵

11

                g2.setPaint(paint);↵

11

                g2.setPaint(paint);↵

12

                g2.draw(line);↵

12

                g2.draw(line);↵

13

            }

13

            }

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 9
   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.3
   Clone type | Type 2

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

   1

       ValueAxis axis = getRangeAxis();

   1 | ValueAxis axis = getRangeAxis();
   1 | ValueAxis axis = getDomainAxis();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getRangeAxis | getDomainAxis | METHOD_INVOCATION_NAME_MISMATCH

   1

       ValueAxis axis = getDomainAxis();

   2

       if (getOrientation() == PlotOrientation.HORIZONTAL)

   2

       if (getOrientation() == PlotOrientation.HORIZONTAL)

   3

       axis = getDomainAxis();

   3 | axis = getDomainAxis();
   3 | axis = getRangeAxis();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getDomainAxis | getRangeAxis | METHOD_INVOCATION_NAME_MISMATCH

   3

       axis = getRangeAxis();

   4

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

   4

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

   5

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

   5 | double yy = axis.valueToJava2D(value, dataArea, RectangleEdge.LEFT);
   5 | double xx = axis.valueToJava2D(value, dataArea, RectangleEdge.BOTTOM);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   yy | xx | VARIABLE_NAME_MISMATCH
   LEFT | BOTTOM | VARIABLE_NAME_MISMATCH

   5

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

   6

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

   6 | Line2D line = new Line2D.Double(dataArea.getMinX(), yy, dataArea.getMaxX(), yy);
   6 | Line2D line = new Line2D.Double(xx, dataArea.getMinY(), xx, dataArea.getMaxY());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   dataArea.getMinX() | xx | TYPE_COMPATIBLE_REPLACEMENT
   yy | dataArea.getMinY() | TYPE_COMPATIBLE_REPLACEMENT
   dataArea.getMaxX() | xx | TYPE_COMPATIBLE_REPLACEMENT
   yy | dataArea.getMaxY() | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression xx cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression yy cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression xx cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression yy cannot be parameterized, because it has dependencies to/from statements that will be extracted

   6

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

   7

       g2.setStroke(stroke);

   7

       g2.setStroke(stroke);

   8

       g2.setPaint(paint);

   8

       g2.setPaint(paint);

   9

       g2.draw(line);

   9

       g2.draw(line);

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Expression xx cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression yy cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression xx cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression yy cannot be parameterized, because it has dependencies to/from statements that will be extracted