468-3-7

Number[][] data = new Integer[][] {{new Integer(-30), new Integer(-20)}, {new Integer(-10), new Integer(10)}, {new Integer(20), new Integer(30)}}; CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", "C", data); LocalListener l = new LocalListener(); this.chart.addChangeListener(l); CategoryPlot plot = (CategoryPlot) this.chart.getPlot(); plot.setDataset(newData); assertEquals(true, l.flag); ValueAxis axis = plot.getRangeAxis(); Range range = axis.getRange(); assertTrue("Expecting the lower bound of the range to be around -30: " + range.getLowerBound(), range.getLowerBound() <= -30); assertTrue("Expecting the upper bound of the range to be around 30: " + range.getUpperBound(), range.getUpperBound() >= 30);
Number[][] data = new Integer[][] {{new Integer(-30), new Integer(-20)}, {new Integer(-10), new Integer(10)}, {new Integer(20), new Integer(30)}}; CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", "C", data); LocalListener l = new LocalListener(); this.chart.addChangeListener(l); CategoryPlot plot = (CategoryPlot) this.chart.getPlot(); plot.setDataset(newData); assertEquals(true, l.flag); ValueAxis axis = plot.getRangeAxis(); Range range = axis.getRange(); assertTrue("Expecting the lower bound of the range to be around -30: " + range.getLowerBound(), range.getLowerBound() <= -30); 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/BarChartTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/junit/StackedBarChart3DTests.java
Method name: `void testReplaceDataset()` |  | Method name: `void testReplaceDataset()`
Number of AST nodes: 11 |  | Number of AST nodes: 11

1

    Number[][] data = new Integer[][]↵

1

    Number[][] data = new Integer[][]↵

2

                {{new Integer(-30), new Integer(-20)},↵

2

                {{new Integer(-30), new Integer(-20)},↵

3

                 {new Integer(-10), new Integer(10)},↵

3

                 {new Integer(-10), new Integer(10)},↵

4

                 {new Integer(20), new Integer(30)}};↵

4

                 {new Integer(20), new Integer(30)}};↵

5

            CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", ↵

5

            CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", ↵

6

                    "C", data);↵

6

                    "C", data);↵

7

            LocalListener l = new LocalListener();↵

7

            LocalListener l = new LocalListener();↵

8

            this.chart.addChangeListener(l);↵

8

            this.chart.addChangeListener(l);↵

9

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

9

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

10

            plot.setDataset(newData);↵

10

            plot.setDataset(newData);↵

11

            assertEquals(true, l.flag);↵

11

            assertEquals(true, l.flag);↵

12

            ValueAxis axis = plot.getRangeAxis();↵

12

            ValueAxis axis = plot.getRangeAxis();↵

13

            Range range = axis.getRange();↵

13

            Range range = axis.getRange();↵

14

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

14

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

15

                       + range.getLowerBound(), range.getLowerBound() <= -30);↵

15

                        + range.getLowerBound(), range.getLowerBound() <= -30);↵

16

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

16

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

17

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

17

                       + 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 | 121

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 10
   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

       Number[][] data = new Integer[][] {{new Integer(-30), new Integer(-20)}, {new Integer(-10), new Integer(10)}, {new Integer(20), new Integer(30)}};

   1

       Number[][] data = new Integer[][] {{new Integer(-30), new Integer(-20)}, {new Integer(-10), new Integer(10)}, {new Integer(20), new Integer(30)}};

   2

       CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", "C", data);

   2

       CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", "C", data);

   3

       LocalListener l = new LocalListener();

   3

       LocalListener l = new LocalListener();

   4

       this.chart.addChangeListener(l);

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.junit.BarChartTests.LocalListener | org.jfree.chart.junit.StackedBarChart3DTests.LocalListener | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   4

       this.chart.addChangeListener(l);

   5

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

   5

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

   6

       plot.setDataset(newData);

   6

       plot.setDataset(newData);

   7

       assertEquals(true, l.flag);

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.junit.BarChartTests.LocalListener | org.jfree.chart.junit.StackedBarChart3DTests.LocalListener | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   7

       assertEquals(true, l.flag);

   8

       ValueAxis axis = plot.getRangeAxis();

   8

       ValueAxis axis = plot.getRangeAxis();

   9

       Range range = axis.getRange();

   9

       Range range = axis.getRange();

   10

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

   10

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

   11

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

   11

       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.BarChartTests.LocalListener of variable l does not match with type org.jfree.chart.junit.StackedBarChart3DTests.LocalListener of variable l
   2 | Type org.jfree.chart.junit.BarChartTests.LocalListener of variable l does not match with type org.jfree.chart.junit.StackedBarChart3DTests.LocalListener of variable l