1388-5-19

CategoryPlot plot = (CategoryPlot) this.chart.getPlot(); CategoryItemRenderer renderer = plot.getRenderer(); StandardCategoryToolTipGenerator tt = new StandardCategoryToolTipGenerator(); renderer.setSeriesToolTipGenerator(0, tt); CategoryToolTipGenerator tt2 = renderer.getToolTipGenerator(0, 0); assertTrue(tt2 == tt);
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);

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/StackedBarChartTests.java
Method name: `void testSetSeriesToolTipGenerator()` |  | Method name: `void testSetSeriesURLGenerator()`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

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

1

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

2

            CategoryItemRenderer renderer = plot.getRenderer();↵

2

            CategoryItemRenderer renderer = plot.getRenderer();↵

3

            StandardCategoryToolTipGenerator tt↵

3

            StandardCategoryURLGenerator url1↵

4

                    = new StandardCategoryToolTipGenerator();↵

4

                    = new StandardCategoryURLGenerator();↵

5

            renderer.setSeriesToolTipGenerator(0, tt);↵

5

            renderer.setSeriesItemURLGenerator(0, url1);↵

6

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

6

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

7

            assertTrue(tt2 == tt);

7

            assertTrue(url2 == url1);

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 | 4
   Number of unmapped statements in the first code fragment | 2
   Number of unmapped statements in the second code fragment | 2
   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();

   2

       CategoryItemRenderer renderer = plot.getRenderer();

   2

       CategoryItemRenderer renderer = plot.getRenderer();

   3

       StandardCategoryURLGenerator url1 = new StandardCategoryURLGenerator();

   3

       StandardCategoryToolTipGenerator tt = new StandardCategoryToolTipGenerator();

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

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

   5

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

   4

       renderer.setSeriesToolTipGenerator(0, tt);

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

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

   Preondition Violations
   Expression renderer.setSeriesToolTipGenerator(0,tt) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   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) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   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

   6

       assertTrue(url2 == url1);

   5

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

   5 | CategoryToolTipGenerator tt2 = renderer.getToolTipGenerator(0, 0);

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

   6

       assertTrue(tt2 == tt);

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

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

   Preondition Violations
   Expression renderer.setSeriesItemURLGenerator(0,url1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   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 renderer.setSeriesItemURLGenerator(0,url1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   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

   4

       renderer.setSeriesItemURLGenerator(0, url1);

   Precondition Violations (14)
   Row | Violation
   --- | ---
   1 | Unmatched statement CategoryURLGenerator url2=renderer.getItemURLGenerator(0,0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Expression renderer.setSeriesToolTipGenerator(0,tt) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression renderer.setSeriesToolTipGenerator(0,tt) is a void method call, and thus it cannot be parameterized
   4 | Expression assertTrue(url2 == url1) is a void method call, and thus it cannot be parameterized
   5 | Expression renderer.setSeriesToolTipGenerator(0,tt) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   6 | Expression renderer.setSeriesToolTipGenerator(0,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 | Unmatched statement CategoryToolTipGenerator tt2=renderer.getToolTipGenerator(0,0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   9 | Expression renderer.setSeriesItemURLGenerator(0,url1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   10 | Expression assertTrue(tt2 == tt) is a void method call, and thus it cannot be parameterized
   11 | Expression renderer.setSeriesItemURLGenerator(0,url1) is a void method call, and thus it cannot be parameterized
   12 | Expression renderer.setSeriesItemURLGenerator(0,url1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   13 | Expression assertTrue(tt2 == tt) is a void method call, and thus it cannot be parameterized
   14 | Expression renderer.setSeriesItemURLGenerator(0,url1) is a void method call, and thus it cannot be parameterized