461-1-2

XYSeries series = new XYSeries("Series 1"); series.add(1.0, 1.0); series.add(2.0, 2.0); series.add(3.0, 3.0); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series); JFreeChart chart = ChartFactory.createScatterPlot( "Test", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false ); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis axis = (NumberAxis) plot.getDomainAxis(); axis.setAutoRangeIncludesZero(false); assertEquals(0.9, axis.getLowerBound(), EPSILON); assertEquals(3.1, axis.getUpperBound(), EPSILON);
XYSeries series = new XYSeries("Series 1"); series.add(1.0, 1.0); series.add(2.0, 2.0); series.add(3.0, 3.0); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series); JFreeChart chart = ChartFactory.createScatterPlot( "Test", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false ); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis axis = (NumberAxis) plot.getRangeAxis(); axis.setAutoRangeIncludesZero(false); assertEquals(0.9, axis.getLowerBound(), EPSILON); assertEquals(3.1, axis.getUpperBound(), EPSILON);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/NumberAxisTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/NumberAxisTests.java
Method name: `void testXYAutoRange1()` |  | Method name: `void testXYAutoRange2()`
Number of AST nodes: 12 |  | Number of AST nodes: 12

1

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

1

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

2

            series.add(1.0, 1.0);↵

2

            series.add(1.0, 1.0);↵

3

            series.add(2.0, 2.0);↵

3

            series.add(2.0, 2.0);↵

4

            series.add(3.0, 3.0);↵

4

            series.add(3.0, 3.0);↵

5

            XYSeriesCollection dataset = new XYSeriesCollection();↵

5

            XYSeriesCollection dataset = new XYSeriesCollection();↵

6

            dataset.addSeries(series);↵

6

            dataset.addSeries(series);↵

7

            JFreeChart chart = ChartFactory.createScatterPlot(↵

7

            JFreeChart chart = ChartFactory.createScatterPlot(↵

8

                "Test", ↵

8

                "Test", ↵

9

                "X",↵

9

                "X",↵

10

                "Y",↵

10

                "Y",↵

11

                dataset,↵

11

                dataset,↵

12

                PlotOrientation.VERTICAL,↵

12

                PlotOrientation.VERTICAL,↵

13

                false, ↵

13

                false, ↵

14

                false,↵

14

                false,↵

15

                false↵

15

                false↵

16

            );↵

16

            );↵

17

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

17

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

18

            NumberAxis axis = (NumberAxis) plot.getDomainAxis();↵

18

            NumberAxis axis = (NumberAxis) plot.getRangeAxis();↵

19

            axis.setAutoRangeIncludesZero(false);↵

19

            axis.setAutoRangeIncludesZero(false);↵

20

            assertEquals(0.9, axis.getLowerBound(), EPSILON);    ↵

20

            assertEquals(0.9, axis.getLowerBound(), EPSILON);    ↵

21

            assertEquals(3.1, axis.getUpperBound(), EPSILON);

21

            assertEquals(3.1, axis.getUpperBound(), EPSILON);

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 declared in the same class
Number of node comparisons | 63

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 12
   Number of unmapped statements in the first code fragment | 0
   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
   --- | --- | --- | --- | ---

   1

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

   1

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

   2

       series.add(1.0, 1.0);

   2

       series.add(1.0, 1.0);

   3

       series.add(2.0, 2.0);

   3

       series.add(2.0, 2.0);

   4

       series.add(3.0, 3.0);

   4

       series.add(3.0, 3.0);

   5

       XYSeriesCollection dataset = new XYSeriesCollection();

   5

       XYSeriesCollection dataset = new XYSeriesCollection();

   6

       dataset.addSeries(series);

   6

       dataset.addSeries(series);

   7

       JFreeChart chart = ChartFactory.createScatterPlot("Test", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);

   7

       JFreeChart chart = ChartFactory.createScatterPlot("Test", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);

   8

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

   8

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

   9

       NumberAxis axis = (NumberAxis)plot.getDomainAxis();

   9 | NumberAxis axis = (NumberAxis)plot.getDomainAxis();
   9 | NumberAxis axis = (NumberAxis)plot.getRangeAxis();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getDomainAxis | getRangeAxis | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression plot.getDomainAxis() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression plot.getRangeAxis() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   9

       NumberAxis axis = (NumberAxis)plot.getRangeAxis();

   10

       axis.setAutoRangeIncludesZero(false);

   10

       axis.setAutoRangeIncludesZero(false);

   11

       assertEquals(0.9, axis.getLowerBound(), EPSILON);

   11

       assertEquals(0.9, axis.getLowerBound(), EPSILON);

   12

       assertEquals(3.1, axis.getUpperBound(), EPSILON);

   12

       assertEquals(3.1, axis.getUpperBound(), EPSILON);

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Expression plot.getDomainAxis() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression plot.getRangeAxis() cannot be parameterized, because it has dependencies to/from statements that will be extracted