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;
if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } DateAxis xAxis = new DateAxis(xAxisLabel); NumberAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); XYToolTipGenerator toolTipGenerator = null; if (tooltips) { toolTipGenerator = new StandardXYToolTipGenerator(); } XYURLGenerator urlGenerator = null; if (urls) { urlGenerator = new StandardXYURLGenerator(); } XYItemRenderer renderer = new XYStepRenderer(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 createStackedXYAreaChart(String, String, String, TableXYDataset, PlotOrientation, boolean, boolean, boolean) Method name: JFreeChart createXYStepChart(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
        DateAxis xAxis = new DateAxis(xAxisLabel);
5
        xAxis.setAutoRangeIncludesZero(false);
5
        
6
        xAxis.setLowerMargin(0.0);
6
NumberAxis yAxis = new NumberAxis(yAxisLabel);
7
        xAxis.setUpperMargin(0.0);
7
        yAxis.set
8
        NumberAxis yAxis = new NumberAxis(yAxisLabel);
8
StandardTickUnits(NumberAxis.createIntegerTickUnits());
9
        XYToolTipGenerator toolTipGenerator = null;
9
        XYToolTipGenerator toolTipGenerator = null;
10
        if (tooltips) {
10
        if (tooltips) {
11
            toolTipGenerator = new StandardXYToolTipGenerator();
11
            toolTipGenerator = new StandardXYToolTipGenerator();
12
        }
12
        }
13
        XYURLGenerator urlGenerator = null;
13
        XYURLGenerator urlGenerator = null;
14
        if (urls) {
14
        if (urls) {
15
            urlGenerator = new StandardXYURLGenerator();
15
            urlGenerator = new StandardXYURLGenerator();
16
        }
16
        }
17
        StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2(
17
        XYItemRenderer renderer 
18
                toolTipGenerator, urlGenerator);
19
        renderer.setOutline(true);
18
            = new XYStepRenderer(toolTipGenerator, urlGenerator);
20
        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, 
19
        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
21
renderer);
20
        plot.setRenderer(renderer);
22
        plot.setOrientation(orientation);
21
        plot.setOrientation(orientation);
23
        plot.setRangeAxis(yAxis);  // forces recalculation of the axis range
22
        plot.set
23
DomainCrosshairVisible(false);
24
        plot.setRangeCrosshairVisible(false);
24
        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
25
        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
25
                plot, legend);
26
                plot, legend);
26
        return chart;
27
        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 comparisons113
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements16
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)251.4
    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);
    3
    DateAxis xAxis = new DateAxis(xAxisLabel);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.NumberAxisorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.NumberAxisorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.NumberAxisorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new NumberAxis(xAxisLabel) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new DateAxis(xAxisLabel) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    DateAxis xAxis = new DateAxis(xAxisLabel);
    4
    xAxis.setAutoRangeIncludesZero(false);
    4
    xAxis.setAutoRangeIncludesZero(false);
    Preondition Violations
    Unmatched statement xAxis.setAutoRangeIncludesZero(false); 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);
    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
                                                              
    6
    xAxis.setUpperMargin(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
                                                              
    7
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    4
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
                                                                                                                                          
    5
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    Preondition Violations
    Unmatched statement yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    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
    StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2(toolTipGenerator, urlGenerator);
    14
    StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2(toolTipGenerator, urlGenerator);
    12
    XYItemRenderer renderer = new XYStepRenderer(toolTipGenerator, urlGenerator);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.renderer.xy.StackedXYAreaRenderer2org.jfree.chart.renderer.xy.XYItemRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.renderer.xy.StackedXYAreaRenderer2org.jfree.chart.renderer.xy.XYItemRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.renderer.xy.StackedXYAreaRenderer2org.jfree.chart.renderer.xy.XYStepRendererSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new StackedXYAreaRenderer2(toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYStepRenderer(toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    XYItemRenderer renderer = new XYStepRenderer(toolTipGenerator, urlGenerator);
    15
    renderer.setOutline(true);
    15
    renderer.setOutline(true);
    16
    plot.setDomainCrosshairVisible(false);
    Differences
    Expression1Expression2Difference
    truefalseLITERAL_VALUE_MISMATCH
    setOutlinesetDomainCrosshairVisibleMETHOD_INVOCATION_NAME_MISMATCH
    rendererplotVARIABLE_NAME_MISMATCH
    org.jfree.chart.renderer.xy.StackedXYAreaRenderer2org.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression renderer.setOutline(true) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.setDomainCrosshairVisible(false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression renderer.setOutline(true) is a void method call, and thus it cannot be parameterized
    Expression plot.setDomainCrosshairVisible(false) is a void method call, and thus it cannot be parameterized
    Expression renderer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression renderer cannot be unified with expression plot , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void setOutline(boolean) , public void setDomainCrosshairVisible(boolean)
    16
    plot.setDomainCrosshairVisible(false);
    16
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    16
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    13
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.TableXYDatasetorg.jfree.data.xy.XYDatasetSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.NumberAxisorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    renderernullTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression renderer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
                                                                  
    14
    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
    14
    plot.setRenderer(renderer);
    17
    plot.setOrientation(orientation);
    15
    plot.setOrientation(orientation);
                                                                                      
    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);
    18
    plot.setRangeAxis(yAxis);
    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
                                                              
    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 (20)
    Row Violation
    1Expression new NumberAxis(xAxisLabel) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new DateAxis(xAxisLabel) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement xAxis.setAutoRangeIncludesZero(false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched 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
    5Unmatched 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
    6Unmatched statement yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Expression new StackedXYAreaRenderer2(toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression new XYStepRenderer(toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression renderer.setOutline(true) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression plot.setDomainCrosshairVisible(false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression renderer.setOutline(true) is a void method call, and thus it cannot be parameterized
    12Expression plot.setDomainCrosshairVisible(false) is a void method call, and thus it cannot be parameterized
    13Expression renderer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression plot cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression renderer cannot be unified with expression plot , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void setOutline(boolean) , public void setDomainCrosshairVisible(boolean)
    16Expression renderer cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Unmatched statement plot.setRenderer(renderer); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    18Unmatched statement plot.setRangeCrosshairVisible(false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    19Unmatched statement plot.setRangeAxis(yAxis); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    20Clone fragment #1 returns variables , while Clone fragment #2 returns variables renderer, plot