210-3-5

if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis(valueAxisLabel); StackedAreaRenderer renderer = new StackedAreaRenderer(); 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 createStackedAreaChart(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(categoryAxisLabel);↵

4

            ↵

5

            ValueAxis value↵

5

    NumberAxis xAxis = new NumberAxis(xAxisLabel);↵

6

            xAxis.setAutoRangeIncludesZero(false);↵

6

    Axis = new NumberAxis(valueAxisLabel);↵

7

            ValueAxis yAxis = new NumberAxis(yAxisLabel);↵

7

            StackedAreaRenderer renderer = new StackedAreaRenderer();↵

8

            XYItemRenderer renderer = new XYBarRenderer();↵

8

            if (tooltips) {↵

9

            if (tooltips) {↵

9

                renderer.setBaseToolTipGenerator(↵

10

                renderer.setBaseToolTipGenerator(↵

10

                        new StandardCategoryToolTipGenerator());↵

11

    new StandardXYToolTipGenerator());↵

11

            }↵

12

            }↵

12

            if (urls) {↵

13

            if (urls) {↵

13

                renderer.setBaseItemURLGenerator(↵

14

                renderer.setURLGenerator(↵

14

                        new StandardCategoryURLGenerator());↵

15

    new StandardXYURLGenerator());↵

15

            }↵

16

            }↵

16

            CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, ↵

17

            XYPlot plot = new XYPlot(dataset, ↵

17

                    renderer);↵

18

    xAxis, yAxis, renderer);↵

18

            plot.setOrientation(orientation);↵

19

            plot.setOrientation(orientation);↵

19

            JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, ↵

20

            JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,↵

20

                    plot, legend);↵

21

                    plot, legend);↵

21

            return chart;

22

            return chart;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2
Clones location | Clones are declared in the same class
Number of node comparisons | 74

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 11
   Number of unmapped statements in the first code fragment | 2
   Number of unmapped statements in the second code fragment | 3
   Time elapsed for statement mapping (ms) | 467.6
   Clone type | Type 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
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.axis.CategoryAxis | org.jfree.chart.axis.NumberAxis | SUBCLASS_TYPE_MISMATCH
   categoryAxis | xAxis | VARIABLE_NAME_MISMATCH
   org.jfree.chart.axis.CategoryAxis | org.jfree.chart.axis.NumberAxis | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.axis.CategoryAxis | org.jfree.chart.axis.NumberAxis | SUBCLASS_TYPE_MISMATCH
   categoryAxisLabel | xAxisLabel | VARIABLE_NAME_MISMATCH

   3

       NumberAxis xAxis = new NumberAxis(xAxisLabel);

   4

       xAxis.setAutoRangeIncludesZero(false);

   4

       ValueAxis valueAxis = new NumberAxis(valueAxisLabel);

   4 | ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
   5 | ValueAxis yAxis = new NumberAxis(yAxisLabel);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   valueAxis | yAxis | VARIABLE_NAME_MISMATCH
   valueAxisLabel | yAxisLabel | VARIABLE_NAME_MISMATCH

   5

       ValueAxis yAxis = new NumberAxis(yAxisLabel);

   5

       StackedAreaRenderer renderer = new StackedAreaRenderer();

   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
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.labels.StandardCategoryToolTipGenerator | org.jfree.chart.labels.StandardXYToolTipGenerator | VARIABLE_TYPE_MISMATCH
   org.jfree.chart.renderer.category.StackedAreaRenderer | org.jfree.chart.renderer.xy.XYItemRenderer | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.labels.StandardCategoryToolTipGenerator of variable new StandardCategoryToolTipGenerator() does not match with type org.jfree.chart.labels.StandardXYToolTipGenerator of variable new StandardXYToolTipGenerator()
   - Make classes org.jfree.chart.labels.StandardCategoryToolTipGenerator and org.jfree.chart.labels.StandardXYToolTipGenerator extend a common superclass

   Type org.jfree.chart.renderer.category.StackedAreaRenderer of variable renderer does not match with type org.jfree.chart.renderer.xy.XYItemRenderer of variable renderer
   - Make classes org.jfree.chart.renderer.category.StackedAreaRenderer and org.jfree.chart.renderer.xy.XYItemRenderer extend a common superclass

   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
   Expression1 | Expression2 | Difference
   --- | --- | ---
   setBaseItemURLGenerator | setURLGenerator | METHOD_INVOCATION_NAME_MISMATCH
   org.jfree.chart.urls.StandardCategoryURLGenerator | org.jfree.chart.urls.StandardXYURLGenerator | VARIABLE_TYPE_MISMATCH
   org.jfree.chart.renderer.category.StackedAreaRenderer | org.jfree.chart.renderer.xy.XYItemRenderer | VARIABLE_TYPE_MISMATCH

   Preondition Violations
   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

   Type org.jfree.chart.urls.StandardCategoryURLGenerator of variable new StandardCategoryURLGenerator() does not match with type org.jfree.chart.urls.StandardXYURLGenerator of variable new StandardXYURLGenerator()
   - Make classes org.jfree.chart.urls.StandardCategoryURLGenerator and org.jfree.chart.urls.StandardXYURLGenerator extend a common superclass

   Type org.jfree.chart.renderer.category.StackedAreaRenderer of variable renderer does not match with type org.jfree.chart.renderer.xy.XYItemRenderer of variable renderer
   - Make classes org.jfree.chart.renderer.category.StackedAreaRenderer and org.jfree.chart.renderer.xy.XYItemRenderer extend a common superclass

   10

       renderer.setURLGenerator(new StandardXYURLGenerator());

   10

       CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);

   10 | CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);

   Preondition Violations
   Unmatched statement CategoryPlot plot=new CategoryPlot(dataset,categoryAxis,valueAxis,renderer); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   11 | XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);

   Preondition Violations
   Unmatched statement XYPlot plot=new XYPlot(dataset,xAxis,yAxis,renderer); cannot be moved before or after the extracted code, 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
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.CategoryPlot | org.jfree.chart.plot.XYPlot | SUBCLASS_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
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.CategoryPlot | org.jfree.chart.plot.XYPlot | SUBCLASS_TYPE_MISMATCH

   13

       JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

   13

       return chart;

   14

       return chart;

   Precondition Violations (10)
   Row | Violation
   --- | ---
   1 | Type org.jfree.chart.labels.StandardCategoryToolTipGenerator of variable new StandardCategoryToolTipGenerator() does not match with type org.jfree.chart.labels.StandardXYToolTipGenerator of variable new StandardXYToolTipGenerator()
   2 | Type org.jfree.chart.renderer.category.StackedAreaRenderer of variable renderer does not match with type org.jfree.chart.renderer.xy.XYItemRenderer of variable renderer
   3 | Expression renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator()) is a void method call, and thus it cannot be parameterized
   4 | Expression renderer.setURLGenerator(new StandardXYURLGenerator()) is a void method call, and thus it cannot be parameterized
   5 | Type org.jfree.chart.urls.StandardCategoryURLGenerator of variable new StandardCategoryURLGenerator() does not match with type org.jfree.chart.urls.StandardXYURLGenerator of variable new StandardXYURLGenerator()
   6 | Type org.jfree.chart.renderer.category.StackedAreaRenderer of variable renderer does not match with type org.jfree.chart.renderer.xy.XYItemRenderer of variable renderer
   7 | Unmatched statement CategoryPlot plot=new CategoryPlot(dataset,categoryAxis,valueAxis,renderer); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   8 | Unmatched statement XYPlot plot=new XYPlot(dataset,xAxis,yAxis,renderer); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   9 | 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)
   10 | Clone fragment #1 returns variables categoryAxis, valueAxis , while Clone fragment #2 returns variables xAxis, yAxis