if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis(valueAxisLabel); LineAndShapeRenderer renderer = new LineAndShapeRenderer(true, false); if (tooltips) { renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); } if (urls) { renderer.setBaseItemURLGenerator( new StandardCategoryURLGenerator()); } CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, 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); XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(orientation); if (tooltips) { renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); } if (urls) { renderer.setURLGenerator(new StandardXYURLGenerator()); } 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 createLineChart(String, String, String, CategoryDataset, PlotOrientation, boolean, boolean, boolean) Method name: JFreeChart createXYLineChart(String, String, String, XYDataset, PlotOrientation, boolean, boolean, boolean)
Number of AST nodes: 13 Number of AST nodes: 14
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
        CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
4
        
5
        ValueAxis value
5
NumberAxis xAxis = new NumberAxis(xAxisLabel);
6
        xAxis.setAutoRangeIncludesZero(false);
6
Axis = new NumberAxis(valueAxisLabel);
7
        NumberAxis yAxis = new NumberAxis(yAxisLabel);
7
        LineAndShapeRenderer renderer = new LineAndShapeRenderer(true, false);
8
        XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
9
        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
10
        plot.setOrientation(orientation);
8
        if (tooltips) {
11
        if (tooltips) {
9
            renderer.setBaseToolTipGenerator(
12
            renderer.setBaseToolTipGenerator(
10
                    new StandardCategoryToolTipGenerator());
13
new StandardXYToolTipGenerator());
11
        }
14
        }
12
        if (urls) {
15
        if (urls) {
13
            renderer.setBaseItemURLGenerator(
16
            renderer.setURLGenerator(
14
                    new StandardCategoryURLGenerator());
17
new StandardXYURLGenerator());
15
        }
18
        }
16
        CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, 
17
                renderer);
18
        plot.setOrientation(orientation);
19
        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
19
        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
20
                plot, legend);
20
                plot, legend);
21
        return chart;
21
        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.2
Clones locationClones are declared in the same class
Number of node comparisons41
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)272.6
    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
    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    3
    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    3
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    categoryAxisxAxisVARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    categoryAxisLabelxAxisLabelVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression new CategoryAxis(categoryAxisLabel) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new NumberAxis(xAxisLabel) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
                                                                                      
    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
    4
    xAxis.setAutoRangeIncludesZero(false);
    4
    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
    4
    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
    5
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.ValueAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    valueAxisyAxisVARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.ValueAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    valueAxisLabelyAxisLabelVARIABLE_NAME_MISMATCH
    5
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    5
    LineAndShapeRenderer renderer = new LineAndShapeRenderer(true, false);
    5
    LineAndShapeRenderer renderer = new LineAndShapeRenderer(true, false);
    6
    XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.renderer.category.LineAndShapeRendererorg.jfree.chart.renderer.xy.XYItemRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.renderer.category.LineAndShapeRendererorg.jfree.chart.renderer.xy.XYItemRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.renderer.category.LineAndShapeRendererorg.jfree.chart.renderer.xy.XYLineAndShapeRendererSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new LineAndShapeRenderer(true,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYLineAndShapeRenderer(true,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
    6
    if (tooltips)
    9
    if (tooltips)
    7
    renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    7
    renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    10
    renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    Differences
    Expression1Expression2Difference
    org.jfree.chart.labels.StandardCategoryToolTipGeneratororg.jfree.chart.labels.StandardXYToolTipGeneratorSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.renderer.category.LineAndShapeRendererorg.jfree.chart.renderer.xy.XYItemRendererSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new StandardCategoryToolTipGenerator() cannot be unified with expression new StandardXYToolTipGenerator() , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public void setBaseToolTipGenerator(org.jfree.chart.labels.CategoryToolTipGenerator)
    Expression renderer cannot be unified with expression renderer , because common superclass org.jfree.chart.LegendItemSource does not declare member(s) public void setBaseToolTipGenerator(org.jfree.chart.labels.CategoryToolTipGenerator) , public abstract void setBaseToolTipGenerator(org.jfree.chart.labels.XYToolTipGenerator)
    10
    renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    8
    if (urls)
    11
    if (urls)
    9
    renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    9
    renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    12
    renderer.setURLGenerator(new StandardXYURLGenerator());
    Differences
    Expression1Expression2Difference
    org.jfree.chart.urls.StandardCategoryURLGeneratororg.jfree.chart.urls.StandardXYURLGeneratorVARIABLE_TYPE_MISMATCH
    setBaseItemURLGeneratorsetURLGeneratorMETHOD_INVOCATION_NAME_MISMATCH
    org.jfree.chart.renderer.category.LineAndShapeRendererorg.jfree.chart.renderer.xy.XYItemRendererSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.urls.StandardCategoryURLGenerator does not match with type org.jfree.chart.urls.StandardXYURLGenerator
    • Make classes org.jfree.chart.urls.StandardCategoryURLGenerator and org.jfree.chart.urls.StandardXYURLGenerator extend a common superclass
    Expression renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression renderer.setURLGenerator(new StandardXYURLGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator()) is a void method call, and thus it cannot be parameterized
    Expression renderer.setURLGenerator(new StandardXYURLGenerator()) is a void method call, and thus it cannot be parameterized
    Expression renderer cannot be unified with expression renderer , because common superclass org.jfree.chart.LegendItemSource does not declare member(s) public void setBaseItemURLGenerator(org.jfree.chart.urls.CategoryURLGenerator) , public abstract void setURLGenerator(org.jfree.chart.urls.XYURLGenerator)
    12
    renderer.setURLGenerator(new StandardXYURLGenerator());
    10
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    10
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    7
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.data.category.CategoryDatasetorg.jfree.data.xy.XYDatasetSUBCLASS_TYPE_MISMATCH
    categoryAxisxAxisVARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    valueAxisyAxisVARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.ValueAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.renderer.category.LineAndShapeRendererorg.jfree.chart.renderer.xy.XYItemRendererSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new CategoryPlot(dataset,categoryAxis,valueAxis,renderer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYPlot(dataset,xAxis,yAxis,renderer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    11
    plot.setOrientation(orientation);
    11
    plot.setOrientation(orientation);
    8
    plot.setOrientation(orientation);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void setOrientation(org.jfree.chart.plot.PlotOrientation)
    8
    plot.setOrientation(orientation);
    12
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    12
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    13
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    13
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    13
    return chart;
    14
    return chart;
    Precondition Violations (16)
    Row Violation
    1Expression new CategoryAxis(categoryAxisLabel) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new NumberAxis(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
    4Expression new LineAndShapeRenderer(true,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression new XYLineAndShapeRenderer(true,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression new StandardCategoryToolTipGenerator() cannot be unified with expression new StandardXYToolTipGenerator() , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public void setBaseToolTipGenerator(org.jfree.chart.labels.CategoryToolTipGenerator)
    7Expression renderer cannot be unified with expression renderer , because common superclass org.jfree.chart.LegendItemSource does not declare member(s) public void setBaseToolTipGenerator(org.jfree.chart.labels.CategoryToolTipGenerator) , public abstract void setBaseToolTipGenerator(org.jfree.chart.labels.XYToolTipGenerator)
    8Type org.jfree.chart.urls.StandardCategoryURLGenerator does not match with type org.jfree.chart.urls.StandardXYURLGenerator
    9Expression renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression renderer.setURLGenerator(new StandardXYURLGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator()) is a void method call, and thus it cannot be parameterized
    12Expression renderer.setURLGenerator(new StandardXYURLGenerator()) is a void method call, and thus it cannot be parameterized
    13Expression renderer cannot be unified with expression renderer , because common superclass org.jfree.chart.LegendItemSource does not declare member(s) public void setBaseItemURLGenerator(org.jfree.chart.urls.CategoryURLGenerator) , public abstract void setURLGenerator(org.jfree.chart.urls.XYURLGenerator)
    14Expression new CategoryPlot(dataset,categoryAxis,valueAxis,renderer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression new XYPlot(dataset,xAxis,yAxis,renderer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void setOrientation(org.jfree.chart.plot.PlotOrientation)