1388-2-26

CategoryPlot plot = (CategoryPlot) this.chart.getPlot(); CategoryItemRenderer renderer = plot.getRenderer(); StandardCategoryURLGenerator url1 = new StandardCategoryURLGenerator(); renderer.setSeriesItemURLGenerator(0, url1); CategoryURLGenerator url2 = renderer.getItemURLGenerator(0, 0); assertTrue(url2 == url1);
XYPlot plot = (XYPlot) this.chart.getPlot(); XYItemRenderer renderer = plot.getRenderer(); StandardXYToolTipGenerator tt = new StandardXYToolTipGenerator(); renderer.setSeriesToolTipGenerator(0, tt); XYToolTipGenerator tt2 = renderer.getToolTipGenerator(0, 0); assertTrue(tt2 == tt);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/junit/AreaChartTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/junit/XYStepAreaChartTests.java
Method name: `void testSetSeriesURLGenerator()` |  | Method name: `void testSetSeriesToolTipGenerator()`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

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

1

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

2

            CategoryItemRenderer renderer = plot.getRenderer();↵

2

            XYItemRenderer renderer = plot.getRenderer();↵

3

            StandardCategoryURLGenerator url1↵

3

            Standard↵

4

                    = new StandardCategoryURLGenerator();↵

4

    XYToolTipGenerator tt = new StandardXYToolTipGenerator();↵

5

            renderer.setSeriesItemURLGenerator(0, url1);↵

5

            renderer.setSeriesToolTipGenerator(0, tt);↵

6

            CategoryURLGenerator url2 = renderer.getItemURLGenerator(0, 0);↵

6

            XYToolTipGenerator tt2 = renderer.getToolTipGenerator(0, 0);↵

7

            assertTrue(url2 == url1);

7

            assertTrue(tt2 == tt);

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

1. {Non-refactorable}

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

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

   1

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

   1 | CategoryPlot plot = (CategoryPlot)this.chart.getPlot();
   1 | XYPlot plot = (XYPlot)this.chart.getPlot();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.CategoryPlot | org.jfree.chart.plot.XYPlot | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.plot.CategoryPlot | org.jfree.chart.plot.XYPlot | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.plot.CategoryPlot | org.jfree.chart.plot.XYPlot | SUBCLASS_TYPE_MISMATCH

   1

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

   2 | XYItemRenderer renderer = plot.getRenderer();

   Preondition Violations
   Unmatched statement XYItemRenderer renderer=plot.getRenderer(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   2

       XYItemRenderer renderer = plot.getRenderer();

   2

       CategoryItemRenderer renderer = plot.getRenderer();

   2 | CategoryItemRenderer renderer = plot.getRenderer();

   Preondition Violations
   Unmatched statement CategoryItemRenderer renderer=plot.getRenderer(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   3

       StandardXYToolTipGenerator tt = new StandardXYToolTipGenerator();

   3

       StandardCategoryURLGenerator url1 = new StandardCategoryURLGenerator();

   5

       XYToolTipGenerator tt2 = renderer.getToolTipGenerator(0, 0);

   4

       renderer.setSeriesItemURLGenerator(0, url1);

   4 | renderer.setSeriesItemURLGenerator(0, url1);
   6 | assertTrue(tt2 == tt);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   setSeriesItemURLGenerator | assertTrue | METHOD_INVOCATION_NAME_MISMATCH
   renderer.setSeriesItemURLGenerator(0,url1) | assertTrue(tt2 == tt) | ARGUMENT_NUMBER_MISMATCH
   renderer |  | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression renderer.setSeriesItemURLGenerator(0,url1) is a void method call, and thus it cannot be parameterized
   Expression assertTrue(tt2 == tt) is a void method call, and thus it cannot be parameterized
   Expression renderer.setSeriesItemURLGenerator(0,url1) is a void method call, and thus it cannot be parameterized
   Expression assertTrue(tt2 == tt) is a void method call, and thus it cannot be parameterized

   6

       assertTrue(tt2 == tt);

   5

       CategoryURLGenerator url2 = renderer.getItemURLGenerator(0, 0);

   6

       assertTrue(url2 == url1);

   6 | assertTrue(url2 == url1);
   4 | renderer.setSeriesToolTipGenerator(0, tt);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertTrue | setSeriesToolTipGenerator | METHOD_INVOCATION_NAME_MISMATCH
   assertTrue(url2 == url1) | renderer.setSeriesToolTipGenerator(0,tt) | ARGUMENT_NUMBER_MISMATCH
   | renderer | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression assertTrue(url2 == url1) is a void method call, and thus it cannot be parameterized
   Expression renderer.setSeriesToolTipGenerator(0,tt) is a void method call, and thus it cannot be parameterized
   Expression assertTrue(url2 == url1) is a void method call, and thus it cannot be parameterized
   Expression renderer.setSeriesToolTipGenerator(0,tt) is a void method call, and thus it cannot be parameterized

   4

       renderer.setSeriesToolTipGenerator(0, tt);

   Precondition Violations (11)
   Row | Violation
   --- | ---
   1 | Unmatched statement XYItemRenderer renderer=plot.getRenderer(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Unmatched statement CategoryItemRenderer renderer=plot.getRenderer(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   3 | Expression renderer.setSeriesItemURLGenerator(0,url1) is a void method call, and thus it cannot be parameterized
   4 | Expression assertTrue(tt2 == tt) is a void method call, and thus it cannot be parameterized
   5 | Expression renderer.setSeriesItemURLGenerator(0,url1) is a void method call, and thus it cannot be parameterized
   6 | Expression assertTrue(tt2 == tt) is a void method call, and thus it cannot be parameterized
   7 | Expression assertTrue(url2 == url1) is a void method call, and thus it cannot be parameterized
   8 | Expression renderer.setSeriesToolTipGenerator(0,tt) is a void method call, and thus it cannot be parameterized
   9 | Expression assertTrue(url2 == url1) is a void method call, and thus it cannot be parameterized
   10 | Expression renderer.setSeriesToolTipGenerator(0,tt) is a void method call, and thus it cannot be parameterized
   11 | Clone fragment #1 returns variable plot with type org.jfree.chart.plot.CategoryPlot , while Clone fragment #2 returns variable plot with type org.jfree.chart.plot.XYPlot