1161-2-5

Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { CategoryPlot plot = (CategoryPlot) iterator.next(); LegendItemCollection more = plot.getLegendItems(); result.addAll(more); }
super.setRenderer(renderer); // not strictly necessary, since the // renderer set for the // parent plot is not used Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { XYPlot plot = (XYPlot) iterator.next(); plot.setRenderer(renderer); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CombinedDomainCategoryPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CombinedDomainXYPlot.java
Method name: `LegendItemCollection getLegendItems()` |  | Method name: `void setRenderer(XYItemRenderer)`
Number of AST nodes: 5 |  | Number of AST nodes: 5

1

    super.setRenderer(renderer);  // not strictly necessary, since the↵

2

                                          // renderer set for the↵

3

                                          // parent plot is not used↵

1

    Iterator iterator = this.subplots.iterator();↵

4

            Iterator iterator = this.subplots.iterator();↵

2

                    while (iterator.hasNext()) {↵

5

            while (iterator.hasNext()) {↵

3

                        CategoryPlot plot = (CategoryPlot) iterator.next();↵

6

                XYPlot plot = (XYPlot) iterator.next();↵

4

                        LegendItemCollection more = plot.getLegendItems();↵

7

                plot.set↵

5

                        result.addAll(more);↵

8

    Renderer(renderer);↵

6

                    }

9

            }

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.1
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 14

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 3
   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) | 10.8
   Clone type | Type 3

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

   1

       super.setRenderer(renderer);

   5

       Iterator iterator = this.subplots.iterator();

   2

       Iterator iterator = this.subplots.iterator();

   6

       while (iterator.hasNext())

   3

       while (iterator.hasNext())

   7

       CategoryPlot plot = (CategoryPlot)iterator.next();

   7 | CategoryPlot plot = (CategoryPlot)iterator.next();
   4 | XYPlot plot = (XYPlot)iterator.next();

   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

   Preondition Violations
   Expression (CategoryPlot)iterator.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression (XYPlot)iterator.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   4

       XYPlot plot = (XYPlot)iterator.next();

   5 | plot.setRenderer(renderer);

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

   5

       plot.setRenderer(renderer);

   8

       LegendItemCollection more = plot.getLegendItems();

   8 | LegendItemCollection more = plot.getLegendItems();

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

   9

       result.addAll(more);

   9 | result.addAll(more);

   Preondition Violations
   Unmatched statement result.addAll(more); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   Precondition Violations (6)
   Row | Violation
   --- | ---
   1 | Expression (CategoryPlot)iterator.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression (XYPlot)iterator.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Unmatched statement plot.setRenderer(renderer); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   4 | Unmatched statement LegendItemCollection more=plot.getLegendItems(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   5 | Unmatched statement result.addAll(more); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   6 | 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