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);
Range range = axis.getRange(); if (!range.contains(value)) { return; } PlotOrientation orientation = plot.getOrientation(); Line2D line = null; double v = axis.valueToJava2D(value, dataArea, plot.getRangeAxisEdge()); if (orientation == PlotOrientation.HORIZONTAL) { line = new Line2D.Double(v, dataArea.getMinY(), v, dataArea.getMaxY()); } else if (orientation == PlotOrientation.VERTICAL) { line = new Line2D.Double(dataArea.getMinX(), v, dataArea.getMaxX(), v); } g2.setPaint(paint); g2.setStroke(stroke); 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/renderer/xy/AbstractXYItemRenderer.java
Method name: void drawRangeCrosshair(Graphics2D, Rectangle2D, PlotOrientation, double, ValueAxis, Stroke, Paint) Method name: void drawRangeLine(Graphics2D, XYPlot, ValueAxis, Rectangle2D, double, Paint, Stroke)
Number of AST nodes: 11 Number of AST nodes: 13
1
if (!axis.getRange()
1
Range range = axis.getRange();
2
.contains(value)) {
2
        if (!range.contains(value)) {
3
            return;
3
            return;
4
        }
4
        }
5
        Line2D line = null;
5
        
6
        if (orientation == PlotOrientation.HORIZONTAL) {
6
PlotOrientation orientation = plot.getOrientation
7
    
7
();
8
        Line2D line = null;
8
        double xx = axis.valueToJava2D(value, dataArea,
9
        double v = axis.valueToJava2D(value, dataArea,
9
                    RectangleEdge.BOTTOM);
10
 plot.getRangeAxisEdge());
11
        if (orientation == PlotOrientation.HORIZONTAL) {
10
            line = new Line2D.Double(xx, dataArea.getMinY(), xx,
12
            line = new Line2D.Double(v, dataArea.getMinY(), v,
11
                    dataArea.getMaxY());
13
                    dataArea.getMaxY());
12
        }
14
        }
13
        else {
15
        else 
14
            double yy = axis.valueToJava2D(value, dataArea,
15
                    RectangleEdge.LEFT);
16
if (orientation == PlotOrientation.VERTICAL) {
16
            line = new Line2D.Double(dataArea.getMinX(), yy,
17
            line = new Line2D.Double(dataArea.getMinX(), v,
17
                    dataArea.getMaxX(), yy);
18
                    dataArea.getMaxX(), v);
18
        }
19
        }
19
        g2.setStroke(stroke);
20
        g2.setPaint(paint);
20
        g2.setPaint(paint);
21
        g2.setStroke(stroke);
21
        g2.draw(line);
22
        g2.draw(line);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.5
Clones locationClones are in different classes
Number of node comparisons22
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)22.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                  
    1
    Range range = axis.getRange();
    1
    if (!axis.getRange().contains(value))
    1
    if (!axis.getRange().contains(value))
    2
    if (!range.contains(value))
    Differences
    Expression1Expression2Difference
    axis.getRange()rangeTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression range cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    if (!range.contains(value))
    2
    return;
    2
    return;
    3
    return;
    Preondition Violations
    Conditional return;
    Conditional return;
    3
    return;
                                                                                                              
    4
    PlotOrientation orientation = plot.getOrientation();
    3
    Line2D line = null;
    5
    Line2D line = null;
                                                                                                                                                  
    6
    double v = axis.valueToJava2D(value, dataArea, plot.getRangeAxisEdge());
    Preondition Violations
    Unmatched statement double v=axis.valueToJava2D(value,dataArea,plot.getRangeAxisEdge()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6
    double v = axis.valueToJava2D(value, dataArea, plot.getRangeAxisEdge());
    4
    if (orientation == PlotOrientation.HORIZONTAL)
    7
    if (orientation == PlotOrientation.HORIZONTAL)
    5
    double xx = axis.valueToJava2D(value, dataArea, RectangleEdge.BOTTOM);
    5
    double xx = axis.valueToJava2D(value, dataArea, RectangleEdge.BOTTOM);
    Preondition Violations
    Unmatched statement double xx=axis.valueToJava2D(value,dataArea,RectangleEdge.BOTTOM); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement double xx=axis.valueToJava2D(value,dataArea,RectangleEdge.BOTTOM); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                                              
    6
    line = new Line2D.Double(xx, dataArea.getMinY(), xx, dataArea.getMaxY());
    6
    line = new Line2D.Double(xx, dataArea.getMinY(), xx, dataArea.getMaxY());
    8
    line = new Line2D.Double(v, dataArea.getMinY(), v, dataArea.getMaxY());
    Differences
    Expression1Expression2Difference
    xxvVARIABLE_NAME_MISMATCH
    xxvVARIABLE_NAME_MISMATCH
    8
    line = new Line2D.Double(v, dataArea.getMinY(), v, dataArea.getMaxY());
    else
            
    7
    double yy = axis.valueToJava2D(value, dataArea, RectangleEdge.LEFT);
    7
    double yy = axis.valueToJava2D(value, dataArea, RectangleEdge.LEFT);
    Preondition Violations
    Unmatched statement double yy=axis.valueToJava2D(value,dataArea,RectangleEdge.LEFT); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement double yy=axis.valueToJava2D(value,dataArea,RectangleEdge.LEFT); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                                          
    8
    line = new Line2D.Double(dataArea.getMinX(), yy, dataArea.getMaxX(), yy);
    8
    line = new Line2D.Double(dataArea.getMinX(), yy, dataArea.getMaxX(), yy);
    Preondition Violations
    Unmatched statement line=new Line2D.Double(dataArea.getMinX(),yy,dataArea.getMaxX(),yy); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                  
    Precondition Violations (9)
    Row Violation
    1Expression range cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Conditional return;
    3Conditional return;
    4Unmatched statement double v=axis.valueToJava2D(value,dataArea,plot.getRangeAxisEdge()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement double xx=axis.valueToJava2D(value,dataArea,RectangleEdge.BOTTOM); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement double xx=axis.valueToJava2D(value,dataArea,RectangleEdge.BOTTOM); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    7Unmatched statement double yy=axis.valueToJava2D(value,dataArea,RectangleEdge.LEFT); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8Unmatched statement double yy=axis.valueToJava2D(value,dataArea,RectangleEdge.LEFT); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    9Unmatched statement line=new Line2D.Double(dataArea.getMinX(),yy,dataArea.getMaxX(),yy); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted