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); xAxis.setLowerMargin(0.0); xAxis.setUpperMargin(0.0); NumberAxis yAxis = new NumberAxis(yAxisLabel); XYToolTipGenerator toolTipGenerator = null; if (tooltips) { toolTipGenerator = new StandardXYToolTipGenerator(); } XYURLGenerator urlGenerator = null; if (urls) { urlGenerator = new StandardXYURLGenerator(); } StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2( toolTipGenerator, urlGenerator); renderer.setOutline(true); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(orientation); plot.setRangeAxis(yAxis); // forces recalculation of the axis range 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 createStackedXYAreaChart(String, String, String, TableXYDataset, PlotOrientation, boolean, boolean, boolean)
Number of AST nodes: 20 Number of AST nodes: 20
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
        xAxis.setLowerMargin(0.0);
7
        yAxis.setAutoRangeIncludesZero(false);
7
        xAxis.set
8
        XYPlot plot = new XYPlot(dataset, x
8
UpperMargin(0.0);
9
Axis, yAxis, null);
9
        NumberAxis yAxis = new NumberAxis(yAxisLabel);
10
        XYToolTipGenerator toolTipGenerator = null;
10
        XYToolTipGenerator toolTipGenerator = null;
11
        if (tooltips) {
11
        if (tooltips) {
12
            toolTipGenerator = new StandardXYToolTipGenerator();
12
            toolTipGenerator = new StandardXYToolTipGenerator();
13
        }
13
        }
14
        XYURLGenerator urlGenerator = null;
14
        XYURLGenerator urlGenerator = null;
15
        if (urls) {
15
        if (urls) {
16
            urlGenerator = new StandardXYURLGenerator();
16
            urlGenerator = new StandardXYURLGenerator();
17
        }
17
        }
18
        XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true);
18
        StackedXYAreaRenderer2 renderer = new 
19
        renderer.setBaseT
19
StackedXYAreaRenderer2(
20
oolTipGenerator(toolTipGenerator);
20
                toolTipGenerator, urlGenerator);
21
        renderer.setURLGenerator(urlGenerator);
21
        renderer.set
22
        plot.setRenderer(renderer);
23
        plot.setOrientation(orientation);
22
Outline(true);
23
        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
24
        plot.setOrientation(orientation);
25
        plot.setRangeAxis(yAxis);  // forces recalculation of the axis range
24
        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
26
        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
25
                plot, legend);
27
                plot, legend);
26
        return chart;
28
        return chart;
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.3
Clones locationClones are declared in the same class
Number of node comparisons116
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements15
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)13.2
    Clone typeType 2
    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
    xAxis.setLowerMargin(0.0);
    Preondition Violations
    Unmatched statement xAxis.setLowerMargin(0.0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    xAxis.setLowerMargin(0.0);
                                                              
    6
    xAxis.setUpperMargin(0.0);
    Preondition Violations
    Unmatched statement xAxis.setUpperMargin(0.0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    xAxis.setUpperMargin(0.0);
    5
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    7
    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);
    7
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    16
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.XYDatasetorg.jfree.data.xy.TableXYDatasetSUBCLASS_TYPE_MISMATCH
    nullrendererTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression renderer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    8
    XYToolTipGenerator toolTipGenerator = null;
    8
    XYToolTipGenerator toolTipGenerator = null;
    9
    if (tooltips)
    9
    if (tooltips)
    10
    toolTipGenerator = new StandardXYToolTipGenerator();
    10
    toolTipGenerator = new StandardXYToolTipGenerator();
    11
    XYURLGenerator urlGenerator = null;
    11
    XYURLGenerator urlGenerator = null;
    12
    if (urls)
    12
    if (urls)
    13
    urlGenerator = new StandardXYURLGenerator();
    13
    urlGenerator = new StandardXYURLGenerator();
                                                                                                                                                                                                
    14
    StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2(toolTipGenerator, urlGenerator);
    Preondition Violations
    Unmatched statement StackedXYAreaRenderer2 renderer=new StackedXYAreaRenderer2(toolTipGenerator,urlGenerator); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14
    StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2(toolTipGenerator, urlGenerator);
    14
    XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true);
    14
    XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true);
    Preondition Violations
    Unmatched statement XYItemRenderer renderer=new XYLineAndShapeRenderer(false,true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                          
                                                                
    15
    renderer.setOutline(true);
    Preondition Violations
    Unmatched statement renderer.setOutline(true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    15
    renderer.setOutline(true);
    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);
    17
    plot.setRenderer(renderer);
    Preondition Violations
    Unmatched statement plot.setRenderer(renderer); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                  
    18
    plot.setOrientation(orientation);
    17
    plot.setOrientation(orientation);
                                                              
    18
    plot.setRangeAxis(yAxis);
    Preondition Violations
    Unmatched statement plot.setRangeAxis(yAxis); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    18
    plot.setRangeAxis(yAxis);
    19
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    19
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    20
    return chart;
    20
    return chart;
    Precondition Violations (12)
    Row Violation
    1Unmatched statement xAxis.setLowerMargin(0.0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement xAxis.setUpperMargin(0.0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement yAxis.setAutoRangeIncludesZero(false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Expression renderer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Unmatched statement StackedXYAreaRenderer2 renderer=new StackedXYAreaRenderer2(toolTipGenerator,urlGenerator); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement XYItemRenderer renderer=new XYLineAndShapeRenderer(false,true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7Unmatched statement renderer.setOutline(true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8Unmatched statement renderer.setBaseToolTipGenerator(toolTipGenerator); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement renderer.setURLGenerator(urlGenerator); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10Unmatched statement plot.setRenderer(renderer); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11Unmatched statement plot.setRangeAxis(yAxis); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12Clone fragment #1 returns variables toolTipGenerator, urlGenerator, plot , while Clone fragment #2 returns variables toolTipGenerator, urlGenerator