466-2-3

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(); LogAxis axis = new LogAxis("Log(Y)"); plot.setRangeAxis(axis); assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON); assertEquals(3.1694019256486126, 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.getDomainAxis(); 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/LogAxisTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/NumberAxisTests.java
Method name: `void testXYAutoRange2()` |  | Method name: `void testXYAutoRange1()`
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

            LogAxis axis = new LogAxis("Log(Y)");↵

18

            NumberAxis axis = ↵

19

            plot.setRangeAxis(axis↵

19

    (NumberAxis) plot.getDomainAxis();↵

20

    );↵

20

            axis.setAutoRangeIncludesZero(false);↵

21

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

21

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

22

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

22

            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 in different classes having the same super class
Number of node comparisons | 71

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

       LogAxis axis = new LogAxis("Log(Y)");

   9 | LogAxis axis = new LogAxis("Log(Y)");
   9 | NumberAxis axis = (NumberAxis)plot.getDomainAxis();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.axis.LogAxis | org.jfree.chart.axis.NumberAxis | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.axis.LogAxis | org.jfree.chart.axis.NumberAxis | SUBCLASS_TYPE_MISMATCH
   new LogAxis("Log(Y)") | (NumberAxis)plot.getDomainAxis() | TYPE_COMPATIBLE_REPLACEMENT

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

   9

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

   10

       plot.setRangeAxis(axis);

   10 | plot.setRangeAxis(axis);
   12 | assertEquals(3.1, axis.getUpperBound(), EPSILON);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   setRangeAxis | assertEquals | METHOD_INVOCATION_NAME_MISMATCH
   plot.setRangeAxis(axis) | assertEquals(3.1,axis.getUpperBound(),EPSILON) | ARGUMENT_NUMBER_MISMATCH
   plot |  | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression plot.setRangeAxis(axis) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertEquals(3.1,axis.getUpperBound(),EPSILON) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression plot.setRangeAxis(axis) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(3.1,axis.getUpperBound(),EPSILON) is a void method call, and thus it cannot be parameterized
   Expression plot.setRangeAxis(axis) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertEquals(3.1,axis.getUpperBound(),EPSILON) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression plot.setRangeAxis(axis) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(3.1,axis.getUpperBound(),EPSILON) is a void method call, and thus it cannot be parameterized

   12

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

   11

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

   11 | assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON);
   11 | assertEquals(0.9, axis.getLowerBound(), EPSILON);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   0.9465508226401592 | 0.9 | LITERAL_VALUE_MISMATCH
   org.jfree.chart.axis.LogAxis | org.jfree.chart.axis.NumberAxis | SUBCLASS_TYPE_MISMATCH

   11

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

   12

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

   12 | assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON);
   10 | axis.setAutoRangeIncludesZero(false);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertEquals | setAutoRangeIncludesZero | METHOD_INVOCATION_NAME_MISMATCH
   assertEquals(3.1694019256486126,axis.getUpperBound(),EPSILON) | axis.setAutoRangeIncludesZero(false) | ARGUMENT_NUMBER_MISMATCH
   | axis | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression assertEquals(3.1694019256486126,axis.getUpperBound(),EPSILON) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression axis.setAutoRangeIncludesZero(false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertEquals(3.1694019256486126,axis.getUpperBound(),EPSILON) is a void method call, and thus it cannot be parameterized
   Expression axis.setAutoRangeIncludesZero(false) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(3.1694019256486126,axis.getUpperBound(),EPSILON) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression axis.setAutoRangeIncludesZero(false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertEquals(3.1694019256486126,axis.getUpperBound(),EPSILON) is a void method call, and thus it cannot be parameterized
   Expression axis.setAutoRangeIncludesZero(false) is a void method call, and thus it cannot be parameterized

   10

       axis.setAutoRangeIncludesZero(false);

   Precondition Violations (17)
   Row | Violation
   --- | ---
   1 | Expression (NumberAxis)plot.getDomainAxis() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression plot.setRangeAxis(axis) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression assertEquals(3.1,axis.getUpperBound(),EPSILON) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression plot.setRangeAxis(axis) is a void method call, and thus it cannot be parameterized
   5 | Expression assertEquals(3.1,axis.getUpperBound(),EPSILON) is a void method call, and thus it cannot be parameterized
   6 | Expression plot.setRangeAxis(axis) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   7 | Expression assertEquals(3.1,axis.getUpperBound(),EPSILON) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   8 | Expression plot.setRangeAxis(axis) is a void method call, and thus it cannot be parameterized
   9 | Expression assertEquals(3.1,axis.getUpperBound(),EPSILON) is a void method call, and thus it cannot be parameterized
   10 | Expression assertEquals(3.1694019256486126,axis.getUpperBound(),EPSILON) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   11 | Expression axis.setAutoRangeIncludesZero(false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   12 | Expression assertEquals(3.1694019256486126,axis.getUpperBound(),EPSILON) is a void method call, and thus it cannot be parameterized
   13 | Expression axis.setAutoRangeIncludesZero(false) is a void method call, and thus it cannot be parameterized
   14 | Expression assertEquals(3.1694019256486126,axis.getUpperBound(),EPSILON) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   15 | Expression axis.setAutoRangeIncludesZero(false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   16 | Expression assertEquals(3.1694019256486126,axis.getUpperBound(),EPSILON) is a void method call, and thus it cannot be parameterized
   17 | Expression axis.setAutoRangeIncludesZero(false) is a void method call, and thus it cannot be parameterized