for (int i = 0; i < this.entities.size(); i++) { ChartEntity entity = (ChartEntity) this.entities.get(i); clone.entities.add(entity.clone()); }
for (int i = 0; i < this.subplotInfo.size(); i++) { PlotRenderingInfo info = (PlotRenderingInfo) this.subplotInfo.get(i); clone.subplotInfo.add(info.clone()); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/entity/StandardEntityCollection.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/PlotRenderingInfo.java
Method name: Object clone() Method name: Object clone()
Number of AST nodes: 3 Number of AST nodes: 3
1
for (int i = 0; i < this.entities.size(); i++) {
1
for (int i = 0; i < this.subplotInfo.size(); i++) {
2
            ChartEntity entity = (ChartEntity) this.entities
2
            PlotRenderingInfo info 
3
.get(i);
3
                    = (PlotRenderingInfo) this.subplotInfo.get(i);
4
            clone.entities.add(entity.clone());
4
            clone.subplotInfo.add(info.clone());
5
        }
5
        }
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.3
Clones locationClones are in different classes
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    for (int i = 0; i < this.entities.size(); i++)
    3
    for (int i = 0; i < this.entities.size(); i++)
    7
    for (int i = 0; i < this.subplotInfo.size(); i++)
    Differences
    Expression1Expression2Difference
    entitiessubplotInfoVARIABLE_NAME_MISMATCH
    7
    for (int i = 0; i < this.subplotInfo.size(); i++)
    4
    ChartEntity entity = (ChartEntity)this.entities.get(i);
    4
    ChartEntity entity = (ChartEntity)this.entities.get(i);
    Preondition Violations
    Unmatched statement ChartEntity entity=(ChartEntity)this.entities.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                    
                                                                                                                                              
    8
    PlotRenderingInfo info = (PlotRenderingInfo)this.subplotInfo.get(i);
    Preondition Violations
    Unmatched statement PlotRenderingInfo info=(PlotRenderingInfo)this.subplotInfo.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    PlotRenderingInfo info = (PlotRenderingInfo)this.subplotInfo.get(i);
    5
    clone.entities.add(entity.clone());
    5
    clone.entities.add(entity.clone());
    9
    clone.subplotInfo.add(info.clone());
    Differences
    Expression1Expression2Difference
    entityinfoVARIABLE_NAME_MISMATCH
    org.jfree.chart.entity.ChartEntityorg.jfree.chart.plot.PlotRenderingInfoVARIABLE_TYPE_MISMATCH
    org.jfree.chart.entity.StandardEntityCollectionorg.jfree.chart.plot.PlotRenderingInfoVARIABLE_TYPE_MISMATCH
    entitiessubplotInfoVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.jfree.chart.entity.ChartEntity of variable entity does not match with type org.jfree.chart.plot.PlotRenderingInfo of variable info
    • Make classes org.jfree.chart.entity.ChartEntity and org.jfree.chart.plot.PlotRenderingInfo extend a common superclass
    Type java.util.List of variable clone.entities does not match with type java.util.List of variable clone.subplotInfo
    • Make classes org.jfree.chart.entity.StandardEntityCollection and org.jfree.chart.plot.PlotRenderingInfo extend a common superclass
    9
    clone.subplotInfo.add(info.clone());
    Precondition Violations (4)
    Row Violation
    1Unmatched statement ChartEntity entity=(ChartEntity)this.entities.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement PlotRenderingInfo info=(PlotRenderingInfo)this.subplotInfo.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type org.jfree.chart.entity.ChartEntity of variable entity does not match with type org.jfree.chart.plot.PlotRenderingInfo of variable info
    4Type java.util.List of variable clone.entities does not match with type java.util.List of variable clone.subplotInfo