137-1-6

DefaultTableXYDataset dataset = new DefaultTableXYDataset(); XYSeries s1 = new XYSeries("Series 1", true, false); s1.add(5.0, 5.0); s1.add(10.0, 15.5); s1.add(15.0, 9.5); s1.add(20.0, 7.5); dataset.addSeries(s1); XYSeries s2 = new XYSeries("Series 2", true, false); s2.add(5.0, 5.0); s2.add(10.0, 15.5); s2.add(15.0, 9.5); s2.add(20.0, 3.5); dataset.addSeries(s2); XYPlot plot = new XYPlot(dataset, new NumberAxis("X"), new NumberAxis("Y"), new XYLineAndShapeRenderer()); plot.addAnnotation(new XYTitleAnnotation(5.0, 6.0, new TextTitle("Hello World!"))); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, null); success = true;
DefaultTableXYDataset dataset = new DefaultTableXYDataset(); XYSeries s1 = new XYSeries("Series 1", true, false); s1.add(5.0, 5.0); s1.add(10.0, 15.5); s1.add(15.0, 9.5); s1.add(20.0, 7.5); dataset.addSeries(s1); XYSeries s2 = new XYSeries("Series 2", true, false); s2.add(5.0, 5.0); s2.add(10.0, 15.5); s2.add(15.0, 9.5); s2.add(20.0, 3.5); dataset.addSeries(s2); XYPlot plot = new XYPlot(dataset, new NumberAxis("X"), new NumberAxis("Y"), new StackedXYAreaRenderer()); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, null); success = true;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/experimental/org/jfree/experimental/chart/annotations/junit/XYTitleAnnotationTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/xy/junit/StackedXYAreaRendererTests.java
Method name: `void testDrawWithNullInfo()` |  | Method name: `void testDrawWithNullInfo()`
Number of AST nodes: 18 |  | Number of AST nodes: 17

1

    DefaultTableXYDataset dataset = new DefaultTableXYDataset();↵

1

    DefaultTableXYDataset dataset = new DefaultTableXYDataset();↵

2

            ↵

3

                XYSeries s1 = new XYSeries("Series 1", true, false);↵

2

                XYSeries s1 = new XYSeries("Series 1", true, false);↵

4

                s1.add(5.0, 5.0);↵

3

                s1.add(5.0, 5.0);↵

5

                s1.add(10.0, 15.5);↵

4

                s1.add(10.0, 15.5);↵

6

                s1.add(15.0, 9.5);↵

5

                s1.add(15.0, 9.5);↵

7

                s1.add(20.0, 7.5);↵

6

                s1.add(20.0, 7.5);↵

8

                dataset.addSeries(s1);↵

7

                dataset.addSeries(s1);↵

9

            ↵

10

                XYSeries s2 = new XYSeries("Series 2", true, false);↵

8

                XYSeries s2 = new XYSeries("Series 2", true, false);↵

11

                s2.add(5.0, 5.0);↵

9

                s2.add(5.0, 5.0);↵

12

                s2.add(10.0, 15.5);↵

10

                s2.add(10.0, 15.5);↵

13

                s2.add(15.0, 9.5);↵

11

                s2.add(15.0, 9.5);↵

14

                s2.add(20.0, 3.5);↵

12

                s2.add(20.0, 3.5);↵

15

                dataset.addSeries(s2);↵

13

                dataset.addSeries(s2);↵

16

                XYPlot plot = new XYPlot(dataset, ↵

14

                XYPlot plot = new XYPlot(dataset,↵

17

                        new NumberAxis("X"), new NumberAxis("Y"), ↵

15

                        new NumberAxis("X"), new NumberAxis("Y"),↵

18

                        new XYLineAndShapeRenderer());↵

16

                        new StackedXYAreaRenderer());↵

19

                plot.addAnnotation(new XYTitleAnnotation(5.0, 6.0, ↵

20

                        new TextTitle("Hello World!")));↵

21

                JFreeChart chart = new JFreeChart(plot);↵

17

                JFreeChart chart = new JFreeChart(plot);↵

22

                /* BufferedImage image = */ chart.createBufferedImage(300, 200, ↵

18

                /* BufferedImage image = */ chart.createBufferedImage(300, 200,↵

23

                        null);↵

19

                        null);↵

24

                success = true;

20

                success = true;

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.0
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 165

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 17
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 0.0
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   3

       DefaultTableXYDataset dataset = new DefaultTableXYDataset();

   3

       DefaultTableXYDataset dataset = new DefaultTableXYDataset();

   4

       XYSeries s1 = new XYSeries("Series 1", true, false);

   4

       XYSeries s1 = new XYSeries("Series 1", true, false);

   5

       s1.add(5.0, 5.0);

   5

       s1.add(5.0, 5.0);

   6

       s1.add(10.0, 15.5);

   6

       s1.add(10.0, 15.5);

   7

       s1.add(15.0, 9.5);

   7

       s1.add(15.0, 9.5);

   8

       s1.add(20.0, 7.5);

   8

       s1.add(20.0, 7.5);

   9

       dataset.addSeries(s1);

   9

       dataset.addSeries(s1);

   10

       XYSeries s2 = new XYSeries("Series 2", true, false);

   10

       XYSeries s2 = new XYSeries("Series 2", true, false);

   11

       s2.add(5.0, 5.0);

   11

       s2.add(5.0, 5.0);

   12

       s2.add(10.0, 15.5);

   12

       s2.add(10.0, 15.5);

   13

       s2.add(15.0, 9.5);

   13

       s2.add(15.0, 9.5);

   14

       s2.add(20.0, 3.5);

   14

       s2.add(20.0, 3.5);

   15

       dataset.addSeries(s2);

   15

       dataset.addSeries(s2);

   16

       XYPlot plot = new XYPlot(dataset, new NumberAxis("X"), new NumberAxis("Y"), new XYLineAndShapeRenderer());

   16 | XYPlot plot = new XYPlot(dataset, new NumberAxis("X"), new NumberAxis("Y"), new XYLineAndShapeRenderer());
   16 | XYPlot plot = new XYPlot(dataset, new NumberAxis("X"), new NumberAxis("Y"), new StackedXYAreaRenderer());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.xy.XYLineAndShapeRenderer | org.jfree.chart.renderer.xy.StackedXYAreaRenderer | SUBCLASS_TYPE_MISMATCH

   16

       XYPlot plot = new XYPlot(dataset, new NumberAxis("X"), new NumberAxis("Y"), new StackedXYAreaRenderer());

   18

       JFreeChart chart = new JFreeChart(plot);

   17

       JFreeChart chart = new JFreeChart(plot);

   19

       chart.createBufferedImage(300, 200, null);

   18

       chart.createBufferedImage(300, 200, null);

   20

       success = true;

   19

       success = true;

   Precondition Violations (1)
   Row | Violation
   --- | ---
   1 | Clone fragment #1 returns variables plot, success , while Clone fragment #2 returns variables success