1581-1-3

if (renderer != null) { int seriesCount = dataset.getRowCount(); for (int i = 0; i < seriesCount; i++) { LegendItem item = renderer.getLegendItem( datasetIndex, i); if (item != null) { result.add(item); } } }
int seriesCount = dataset.getSeriesCount(); for (int i = 0; i < seriesCount; i++) { if (isSeriesVisibleInLegend(i)) { LegendItem item = getLegendItem(index, i); if (item != null) { result.add(item); } } }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CategoryPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java
Method name: `LegendItemCollection getLegendItems()` |  | Method name: `LegendItemCollection getLegendItems()`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

    if (renderer != null) {↵

2

                            int seriesCount = dataset.getRowCount();↵

1

    int seriesCount = dataset.getSeriesCount();↵

3

                            for (int i = 0; i < seriesCount; i++) {↵

2

                for (int i = 0; i < seriesCount; i++) {↵

4

                    ↵

3

                    if (isSeriesVisibleInLegend(i)) {↵

5

                LegendItem item = renderer.getLegendItem(↵

4

                        LegendItem item = getLegendItem(↵

6

                                        datasetIndex, i);↵

5

    index, i);↵

7

                                if (item != null) {↵

6

                        if (item != null) {↵

8

                                    result.add(item);↵

7

                            result.add(item);↵

9

                                }↵

8

                        ↵

10

       ↵

9

    }↵

11

                         }↵

10

                    ↵

12

            ↵

11

    }↵

13

                }

12

                }

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 1
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1
Clones location | Clones are in different classes
Number of node comparisons | 7

1. {Refactorable}

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

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

   12

       LegendItem item = renderer.getLegendItem(datasetIndex, i);

   12 | LegendItem item = renderer.getLegendItem(datasetIndex, i);
   10 | LegendItem item = getLegendItem(index, i);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   datasetIndex | index | VARIABLE_NAME_MISMATCH
   renderer |  | MISSING_METHOD_INVOCATION_EXPRESSION

   10

       LegendItem item = getLegendItem(index, i);

   13

       if (item != null)

   11

       if (item != null)

   14

       result.add(item);

   12

       result.add(item);

   Precondition Violations (0)
   Row | Violation
   --- | ---