202-5-6

XYSeries series1 = new XYSeries("Series 1"); series1.add(10.0, 10.0); series1.add(20.0, 20.0); series1.add(30.0, 30.0); XYDataset dataset = new XYSeriesCollection(series1); LocalListener l = new LocalListener(); this.chart.addChangeListener(l); XYPlot plot = (XYPlot) this.chart.getPlot(); plot.setDataset(dataset); assertEquals(true, l.flag); ValueAxis axis = plot.getRangeAxis(); Range range = axis.getRange(); assertTrue("Expecting the lower bound of the range to be around 10: " + range.getLowerBound(), range.getLowerBound() <= 10); assertTrue("Expecting the upper bound of the range to be around 30: " + range.getUpperBound(), range.getUpperBound() >= 30);
XYSeries series1 = new XYSeries("Series 1"); series1.add(10.0, 10.0); series1.add(20.0, 20.0); series1.add(30.0, 30.0); XYDataset dataset = new XYSeriesCollection(series1); LocalListener l = new LocalListener(); this.chart.addChangeListener(l); XYPlot plot = (XYPlot) this.chart.getPlot(); plot.setDataset(dataset); assertEquals(true, l.flag); ValueAxis axis = plot.getRangeAxis(); Range range = axis.getRange(); assertTrue("Expecting the lower bound of the range to be around 10: " + range.getLowerBound(), range.getLowerBound() <= 10); assertTrue("Expecting the upper bound of the range to be around 30: " + range.getUpperBound(), range.getUpperBound() >= 30);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/junit/XYAreaChartTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/junit/ScatterPlotTests.java
Method name: `void testReplaceDataset()` |  | Method name: `void testReplaceDataset()`
Number of AST nodes: 14 |  | Number of AST nodes: 14

1

    XYSeries series1 = new XYSeries("Series 1");↵

1

    XYSeries series1 = new XYSeries("Series 1");↵

2

            series1.add(10.0, 10.0);↵

2

            series1.add(10.0, 10.0);↵

3

            series1.add(20.0, 20.0);↵

3

            series1.add(20.0, 20.0);↵

4

            series1.add(30.0, 30.0);↵

4

            series1.add(30.0, 30.0);↵

5

            XYDataset dataset = new XYSeriesCollection(series1);↵

5

            XYDataset dataset = new XYSeriesCollection(series1);↵

6

            LocalListener l = new LocalListener();↵

6

            LocalListener l = new LocalListener();↵

7

            this.chart.addChangeListener(l);↵

7

            this.chart.addChangeListener(l);↵

8

            XYPlot plot = (XYPlot) this.chart.getPlot();↵

8

            XYPlot plot = (XYPlot) this.chart.getPlot();↵

9

            plot.setDataset(dataset);↵

9

            plot.setDataset(dataset);↵

10

            assertEquals(true, l.flag);↵

10

            assertEquals(true, l.flag);↵

11

            ValueAxis axis = plot.getRangeAxis();↵

11

            ValueAxis axis = plot.getRangeAxis();↵

12

            Range range = axis.getRange();↵

12

            Range range = axis.getRange();↵

13

            assertTrue("Expecting the lower bound of the range to be around 10: "↵

13

            assertTrue("Expecting the lower bound of the range to be around 10: "↵

14

                       + range.getLowerBound(), range.getLowerBound() <= 10);↵

14

                       + range.getLowerBound(), range.getLowerBound() <= 10);↵

15

            assertTrue("Expecting the upper bound of the range to be around 30: "↵

15

            assertTrue("Expecting the upper bound of the range to be around 30: "↵

16

                       + range.getUpperBound(), range.getUpperBound() >= 30);

16

                       + range.getUpperBound(), range.getUpperBound() >= 30);

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 | 98

1. {Non-refactorable}

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

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

   1

       XYSeries series1 = new XYSeries("Series 1");

   1

       XYSeries series1 = new XYSeries("Series 1");

   2

       series1.add(10.0, 10.0);

   2

       series1.add(10.0, 10.0);

   3

       series1.add(20.0, 20.0);

   3

       series1.add(20.0, 20.0);

   4

       series1.add(30.0, 30.0);

   4

       series1.add(30.0, 30.0);

   5

       XYDataset dataset = new XYSeriesCollection(series1);

   5

       XYDataset dataset = new XYSeriesCollection(series1);

   6

       LocalListener l = new LocalListener();

   6

       LocalListener l = new LocalListener();

   7

       this.chart.addChangeListener(l);

   7 | this.chart.addChangeListener(l);
   7 | this.chart.addChangeListener(l);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.junit.XYAreaChartTests.LocalListener | org.jfree.chart.junit.ScatterPlotTests.LocalListener | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.junit.XYAreaChartTests.LocalListener of variable l does not match with type org.jfree.chart.junit.ScatterPlotTests.LocalListener of variable l
   - Make classes org.jfree.chart.junit.XYAreaChartTests.LocalListener and org.jfree.chart.junit.ScatterPlotTests.LocalListener extend a common superclass

   7

       this.chart.addChangeListener(l);

   8

       XYPlot plot = (XYPlot)this.chart.getPlot();

   8

       XYPlot plot = (XYPlot)this.chart.getPlot();

   9

       plot.setDataset(dataset);

   9

       plot.setDataset(dataset);

   10

       assertEquals(true, l.flag);

   10 | assertEquals(true, l.flag);
   10 | assertEquals(true, l.flag);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.junit.XYAreaChartTests.LocalListener | org.jfree.chart.junit.ScatterPlotTests.LocalListener | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.junit.XYAreaChartTests.LocalListener of variable l does not match with type org.jfree.chart.junit.ScatterPlotTests.LocalListener of variable l
   - Make classes org.jfree.chart.junit.XYAreaChartTests.LocalListener and org.jfree.chart.junit.ScatterPlotTests.LocalListener extend a common superclass

   10

       assertEquals(true, l.flag);

   11

       ValueAxis axis = plot.getRangeAxis();

   11

       ValueAxis axis = plot.getRangeAxis();

   12

       Range range = axis.getRange();

   12

       Range range = axis.getRange();

   13

       assertTrue("Expecting the lower bound of the range to be around 10: " + range.getLowerBound(), range.getLowerBound() <= 10);

   13

       assertTrue("Expecting the lower bound of the range to be around 10: " + range.getLowerBound(), range.getLowerBound() <= 10);

   14

       assertTrue("Expecting the upper bound of the range to be around 30: " + range.getUpperBound(), range.getUpperBound() >= 30);

   14

       assertTrue("Expecting the upper bound of the range to be around 30: " + range.getUpperBound(), range.getUpperBound() >= 30);

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Type org.jfree.chart.junit.XYAreaChartTests.LocalListener of variable l does not match with type org.jfree.chart.junit.ScatterPlotTests.LocalListener of variable l
   2 | Type org.jfree.chart.junit.XYAreaChartTests.LocalListener of variable l does not match with type org.jfree.chart.junit.ScatterPlotTests.LocalListener of variable l