if (this.plot == null) { return new LegendItemCollection(); } LegendItemCollection result = new LegendItemCollection(); int index = this.plot.getIndexOf(this); CategoryDataset dataset = this.plot.getDataset(index); if (dataset != null) { 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); } } } } return result;
if (this.plot == null) { return new LegendItemCollection(); } LegendItemCollection result = new LegendItemCollection(); int index = this.plot.getIndexOf(this); XYDataset dataset = this.plot.getDataset(index); if (dataset != null) { 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); } } } } return result;
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: 13 Number of AST nodes: 13
1
if (this.plot == null) {
1
if (this.plot == null) {
2
            return new LegendItemCollection();
2
            return new LegendItemCollection();
3
        }
3
        }
4
        LegendItemCollection result = new LegendItemCollection();
4
        LegendItemCollection result = new LegendItemCollection();
5
        int index = this.plot.getIndexOf(this);
5
        int index = this.plot.getIndexOf(this);
6
        CategoryDataset dataset = this.plot.getDataset(index);
6
        XYDataset dataset = this.plot.getDataset(index);
7
        if (dataset != null) {
7
        if (dataset != null) {
8
            int seriesCount = dataset.getRowCount();
8
            int seriesCount = dataset.getSeriesCount();
9
            for (int i = 0; i < seriesCount; i++) {
9
            for (int i = 0; i < seriesCount; i++) {
10
                if (isSeriesVisibleInLegend(i)) {
10
                if (isSeriesVisibleInLegend(i)) {
11
                    LegendItem item = getLegendItem(index, i);
11
                    LegendItem item = getLegendItem(index, i);
12
                    if (item != null) {
12
                    if (item != null) {
13
                        result.add(item);
13
                        result.add(item);
14
                    }
14
                    }
15
                }
15
                }
16
            }
16
            }
17
        }
17
        }
18
        return result;
18
        return result;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.8
Clones locationClones are in different classes having the same super class
Number of node comparisons27
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)34.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (this.plot == null)
    1
    if (this.plot == null)
    1
    if (this.plot == null)
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    1
    if (this.plot == null)
    2
    return new LegendItemCollection();
    2
    return new LegendItemCollection();
    3
    LegendItemCollection result = new LegendItemCollection();
    3
    LegendItemCollection result = new LegendItemCollection();
    4
    int index = this.plot.getIndexOf(this);
    4
    int index = this.plot.getIndexOf(this);
    4
    int index = this.plot.getIndexOf(this);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression this.plot cannot be unified with expression this.plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public int getIndexOf(org.jfree.chart.renderer.category.CategoryItemRenderer) , public int getIndexOf(org.jfree.chart.renderer.xy.XYItemRenderer)
    4
    int index = this.plot.getIndexOf(this);
    5
    CategoryDataset dataset = this.plot.getDataset(index);
    5
    CategoryDataset dataset = this.plot.getDataset(index);
    5
    XYDataset dataset = this.plot.getDataset(index);
    Differences
    Expression1Expression2Difference
    org.jfree.data.category.CategoryDatasetorg.jfree.data.xy.XYDatasetSUBCLASS_TYPE_MISMATCH
    org.jfree.data.category.CategoryDatasetorg.jfree.data.xy.XYDatasetSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression this.plot cannot be unified with expression this.plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public org.jfree.data.category.CategoryDataset getDataset(int) , public org.jfree.data.xy.XYDataset getDataset(int)
    5
    XYDataset dataset = this.plot.getDataset(index);
    6
    if (dataset != null)
    6
    if (dataset != null)
    6
    if (dataset != null)
    Differences
    Expression1Expression2Difference
    org.jfree.data.category.CategoryDatasetorg.jfree.data.xy.XYDatasetSUBCLASS_TYPE_MISMATCH
    6
    if (dataset != null)
    7
    int seriesCount = dataset.getRowCount();
    7
    int seriesCount = dataset.getRowCount();
    7
    int seriesCount = dataset.getSeriesCount();
    Differences
    Expression1Expression2Difference
    getRowCountgetSeriesCountMETHOD_INVOCATION_NAME_MISMATCH
    org.jfree.data.category.CategoryDatasetorg.jfree.data.xy.XYDatasetSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression dataset.getRowCount() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset.getSeriesCount() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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);
    13
    return result;
    13
    return result;
    Precondition Violations (4)
    Row Violation
    1Expression this.plot cannot be unified with expression this.plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public int getIndexOf(org.jfree.chart.renderer.category.CategoryItemRenderer) , public int getIndexOf(org.jfree.chart.renderer.xy.XYItemRenderer)
    2Expression this.plot cannot be unified with expression this.plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public org.jfree.data.category.CategoryDataset getDataset(int) , public org.jfree.data.xy.XYDataset getDataset(int)
    3Expression dataset.getRowCount() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression dataset.getSeriesCount() cannot be parameterized, because it has dependencies to/from statements that will be extracted