1581-2-3

int seriesCount = dataset.getRowCount(); for (int i = 0; i < seriesCount; i++) { if (isSeriesVisibleInLegend(i)) { LegendItem item = getLegendItem(index, 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/renderer/category/AbstractCategoryItemRenderer.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

    int seriesCount = dataset.getRowCount();↵

1

    int seriesCount = dataset.getSeriesCount();↵

2

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

2

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

3

                    if (isSeriesVisibleInLegend(i)) {↵

3

                    if (isSeriesVisibleInLegend(i)) {↵

4

                        LegendItem item = getLegendItem(index, i);↵

4

                        LegendItem item = getLegendItem(index, i);↵

5

                        if (item != null) {↵

5

                        if (item != null) {↵

6

                            result.add(item);↵

6

                            result.add(item);↵

7

                        }↵

7

                        }↵

8

                    }↵

8

                    }↵

9

                }

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

1. {Non-refactorable}

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

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

   7

       int seriesCount = dataset.getRowCount();

   7 | int seriesCount = dataset.getRowCount();
   7 | int seriesCount = dataset.getSeriesCount();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getRowCount | getSeriesCount | METHOD_INVOCATION_NAME_MISMATCH
   org.jfree.data.category.CategoryDataset | org.jfree.data.xy.XYDataset | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.data.category.CategoryDataset of variable dataset does not match with type org.jfree.data.xy.XYDataset of variable dataset
   - Make classes org.jfree.data.category.CategoryDataset and org.jfree.data.xy.XYDataset extend a common superclass

   7

       int seriesCount = dataset.getSeriesCount();

   8

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

   8

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

   9

       if (isSeriesVisibleInLegend(i))

   9

       if (isSeriesVisibleInLegend(i))

   10

       LegendItem item = getLegendItem(index, i);

   10

       LegendItem item = getLegendItem(index, i);

   11

       if (item != null)

   11

       if (item != null)

   12

       result.add(item);

   12

       result.add(item);

   Precondition Violations (1)
   Row | Violation
   --- | ---
   1 | Type org.jfree.data.category.CategoryDataset of variable dataset does not match with type org.jfree.data.xy.XYDataset of variable dataset