if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } NumberAxis xAxis = new NumberAxis(xAxisLabel); xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setAutoRangeIncludesZero(false); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null); XYToolTipGenerator toolTipGenerator = null; if (tooltips) { toolTipGenerator = new StandardXYToolTipGenerator(); } XYURLGenerator urlGenerator = null; if (urls) { urlGenerator = new StandardXYURLGenerator(); } XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true); renderer.setBaseToolTipGenerator(toolTipGenerator); renderer.setURLGenerator(urlGenerator); plot.setRenderer(renderer); plot.setOrientation(orientation); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); return chart;
if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } NumberAxis xAxis = new NumberAxis(xAxisLabel); xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis(yAxisLabel); XYToolTipGenerator toolTipGenerator = null; if (tooltips) { toolTipGenerator = new StandardXYToolTipGenerator(); } XYURLGenerator urlGenerator = null; if (urls) { urlGenerator = new StandardXYURLGenerator(); } XYItemRenderer renderer = new XYStepAreaRenderer( XYStepAreaRenderer.AREA_AND_SHAPES, toolTipGenerator, urlGenerator); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null); plot.setRenderer(renderer); plot.setOrientation(orientation); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); return chart;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/ChartFactory.java File path: /jfreechart-1.0.10/src/org/jfree/chart/ChartFactory.java
Method name: JFreeChart createScatterPlot(String, String, String, XYDataset, PlotOrientation, boolean, boolean, boolean) Method name: JFreeChart createXYStepAreaChart(String, String, String, XYDataset, PlotOrientation, boolean, boolean, boolean)
Number of AST nodes: 20 Number of AST nodes: 19
1
if (orientation == null) {
1
if (orientation == null) {
2
            throw new IllegalArgumentException("Null 'orientation' argument.");
2
            throw new IllegalArgumentException("Null 'orientation' argument.");
3
        }
3
        }
4
        NumberAxis xAxis = new NumberAxis(xAxisLabel);
4
        NumberAxis xAxis = new NumberAxis(xAxisLabel);
5
        xAxis.setAutoRangeIncludesZero(false);
5
        xAxis.setAutoRangeIncludesZero(false);
6
        NumberAxis yAxis = new NumberAxis(yAxisLabel);
6
        NumberAxis yAxis = new NumberAxis(yAxisLabel);
7
        yAxis.setAutoRangeIncludesZero(false);
8
        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
9
        XYToolTipGenerator toolTipGenerator = null;
7
        XYToolTipGenerator toolTipGenerator = null;
10
        if (tooltips) {
8
        if (tooltips) {
11
            toolTipGenerator = new StandardXYToolTipGenerator();
9
            toolTipGenerator = new StandardXYToolTipGenerator();
12
        }
10
        }
13
        XYURLGenerator urlGenerator = null;
11
        XYURLGenerator urlGenerator = null;
14
        if (urls) {
12
        if (urls) {
15
            urlGenerator = new StandardXYURLGenerator();
13
            urlGenerator = new StandardXYURLGenerator();
16
        }
14
        }
17
        XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true);
15
        XYItemRenderer renderer = new XY
18
        renderer.setBaseToolTipGenerator(toolTip
16
StepAreaRenderer(
17
                XYStepAreaRenderer.AREA_AND_SHAPES, toolTipGenerator, 
19
Generator);
18
                urlGenerator);
20
        renderer.setURLGenerator(urlGenerator);
19
        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
21
        plot.setRenderer(renderer);
20
        plot.setRenderer(renderer);
22
        plot.setOrientation(orientation);
21
        plot.setOrientation(orientation);
22
        plot.setDomainCrosshairVisible(false);
23
        plot.setRangeCrosshairVisible(false);
23
        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
24
        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
24
                plot, legend);
25
                plot, legend);
25
        return chart;
26
        return chart;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are declared in the same class
Number of node comparisons95
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements17
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)64.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (orientation == null)
    1
    if (orientation == null)
    2
    throw new IllegalArgumentException("Null 'orientation' argument.");
    2
    throw new IllegalArgumentException("Null 'orientation' argument.");
    3
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    3
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    4
    xAxis.setAutoRangeIncludesZero(false);
    4
    xAxis.setAutoRangeIncludesZero(false);
    5
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    5
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    6
    yAxis.setAutoRangeIncludesZero(false);
    6
    yAxis.setAutoRangeIncludesZero(false);
    Preondition Violations
    Unmatched statement yAxis.setAutoRangeIncludesZero(false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                      
    7
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    13
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    8
    XYToolTipGenerator toolTipGenerator = null;
    6
    XYToolTipGenerator toolTipGenerator = null;
    9
    if (tooltips)
    7
    if (tooltips)
    10
    toolTipGenerator = new StandardXYToolTipGenerator();
    8
    toolTipGenerator = new StandardXYToolTipGenerator();
    11
    XYURLGenerator urlGenerator = null;
    9
    XYURLGenerator urlGenerator = null;
    12
    if (urls)
    10
    if (urls)
    13
    urlGenerator = new StandardXYURLGenerator();
    11
    urlGenerator = new StandardXYURLGenerator();
    14
    XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true);
    14
    XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true);
    12
    XYItemRenderer renderer = new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES, toolTipGenerator, urlGenerator);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.renderer.xy.XYLineAndShapeRendererorg.jfree.chart.renderer.xy.XYStepAreaRendererSUBCLASS_TYPE_MISMATCH
    new XYLineAndShapeRenderer(false,true)new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES,toolTipGenerator,urlGenerator)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new XYLineAndShapeRenderer(false,true) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES,toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYLineAndShapeRenderer(false,true) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES,toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    XYItemRenderer renderer = new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES, toolTipGenerator, urlGenerator);
    15
    renderer.setBaseToolTipGenerator(toolTipGenerator);
    15
    renderer.setBaseToolTipGenerator(toolTipGenerator);
    Preondition Violations
    Unmatched statement renderer.setBaseToolTipGenerator(toolTipGenerator); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                  
    16
    renderer.setURLGenerator(urlGenerator);
    16
    renderer.setURLGenerator(urlGenerator);
    Preondition Violations
    Unmatched statement renderer.setURLGenerator(urlGenerator); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                          
    17
    plot.setRenderer(renderer);
    14
    plot.setRenderer(renderer);
    18
    plot.setOrientation(orientation);
    15
    plot.setOrientation(orientation);
                                                                                        
    16
    plot.setDomainCrosshairVisible(false);
    Preondition Violations
    Unmatched statement plot.setDomainCrosshairVisible(false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    16
    plot.setDomainCrosshairVisible(false);
                                                                                      
    17
    plot.setRangeCrosshairVisible(false);
    Preondition Violations
    Unmatched statement plot.setRangeCrosshairVisible(false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    17
    plot.setRangeCrosshairVisible(false);
    19
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    18
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    20
    return chart;
    19
    return chart;
    Precondition Violations (9)
    Row Violation
    1Unmatched statement yAxis.setAutoRangeIncludesZero(false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression new XYLineAndShapeRenderer(false,true) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES,toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new XYLineAndShapeRenderer(false,true) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES,toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Unmatched statement renderer.setBaseToolTipGenerator(toolTipGenerator); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement renderer.setURLGenerator(urlGenerator); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement plot.setDomainCrosshairVisible(false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement plot.setRangeCrosshairVisible(false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted