if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } CategoryAxis categoryAxis = new CategoryAxis(domainAxisLabel); ValueAxis valueAxis = new NumberAxis(rangeAxisLabel); StackedBarRenderer renderer = new StackedBarRenderer(); 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); ValueAxis yAxis = new NumberAxis(yAxisLabel); XYItemRenderer renderer = new XYBarRenderer(); if (tooltips) { renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); } if (urls) { renderer.setURLGenerator(new StandardXYURLGenerator()); } XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(orientation); 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 createStackedBarChart(String, String, String, CategoryDataset, PlotOrientation, boolean, boolean, boolean) Method name: JFreeChart createHistogram(String, String, String, IntervalXYDataset, 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(domainAxisLabel
4
        NumberAxis xAxis = new NumberAxis(xAxisLabel);
5
);
5
        xAxis.setAutoRangeIncludesZero(false);
6
        ValueAxis valueAxis = new NumberAxis(rangeAxisLabel);
6
        ValueAxis yAxis = new NumberAxis(yAxisLabel);
7
        StackedBarRenderer renderer = new StackedBarRenderer();
7
        XYItemRenderer renderer = new XYBarRenderer();
8
        if (tooltips) {
8
        if (tooltips) {
9
            renderer.setBaseToolTipGenerator(
9
            renderer.setBaseToolTipGenerator(
10
                    new StandardCategoryToolTipGenerator());
10
new StandardXYToolTipGenerator());
11
        }
11
        }
12
        if (urls) {
12
        if (urls) {
13
            renderer.setBaseItemURLGenerator(
13
            renderer.setURLGenerator(
14
                    new StandardCategoryURLGenerator());
14
new StandardXYURLGenerator());
15
        }
15
        }
16
        CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, 
16
        XYPlot plot = new XYPlot(dataset, 
17
                renderer);
17
xAxis, yAxis, renderer);
18
        plot.setOrientation(orientation);
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.3
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)604.2
    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(domainAxisLabel);
    3
    CategoryAxis categoryAxis = new CategoryAxis(domainAxisLabel);
    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
    domainAxisLabelxAxisLabelVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression new CategoryAxis(domainAxisLabel) 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(rangeAxisLabel);
    4
    ValueAxis valueAxis = new NumberAxis(rangeAxisLabel);
    5
    ValueAxis yAxis = new NumberAxis(yAxisLabel);
    Differences
    Expression1Expression2Difference
    valueAxisyAxisVARIABLE_NAME_MISMATCH
    rangeAxisLabelyAxisLabelVARIABLE_NAME_MISMATCH
    5
    ValueAxis yAxis = new NumberAxis(yAxisLabel);
    5
    StackedBarRenderer renderer = new StackedBarRenderer();
    5
    StackedBarRenderer renderer = new StackedBarRenderer();
    6
    XYItemRenderer renderer = new XYBarRenderer();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.renderer.category.StackedBarRendererorg.jfree.chart.renderer.xy.XYItemRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.renderer.category.StackedBarRendererorg.jfree.chart.renderer.xy.XYItemRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.renderer.category.StackedBarRendererorg.jfree.chart.renderer.xy.XYBarRendererSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new StackedBarRenderer() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYBarRenderer() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    XYItemRenderer renderer = new XYBarRenderer();
    6
    if (tooltips)
    7
    if (tooltips)
    7
    renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    7
    renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    8
    renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    Differences
    Expression1Expression2Difference
    org.jfree.chart.labels.StandardCategoryToolTipGeneratororg.jfree.chart.labels.StandardXYToolTipGeneratorSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.renderer.category.StackedBarRendererorg.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)
    8
    renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    8
    if (urls)
    9
    if (urls)
    9
    renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    9
    renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    10
    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.StackedBarRendererorg.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
    10
    renderer.setURLGenerator(new StandardXYURLGenerator());
    10
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    10
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    11
    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.IntervalXYDatasetSUBCLASS_TYPE_MISMATCH
    categoryAxisxAxisVARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.CategoryAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    valueAxisyAxisVARIABLE_NAME_MISMATCH
    org.jfree.chart.renderer.category.StackedBarRendererorg.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
    11
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    11
    plot.setOrientation(orientation);
    11
    plot.setOrientation(orientation);
    12
    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)
    12
    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 (14)
    Row Violation
    1Expression new CategoryAxis(domainAxisLabel) 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 StackedBarRenderer() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression new XYBarRenderer() 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)
    7Type org.jfree.chart.urls.StandardCategoryURLGenerator does not match with type org.jfree.chart.urls.StandardXYURLGenerator
    8Expression renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression renderer.setURLGenerator(new StandardXYURLGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator()) is a void method call, and thus it cannot be parameterized
    11Expression renderer.setURLGenerator(new StandardXYURLGenerator()) is a void method call, and thus it cannot be parameterized
    12Expression new CategoryPlot(dataset,categoryAxis,valueAxis,renderer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression new XYPlot(dataset,xAxis,yAxis,renderer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression 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)