HistogramDataset clone = (HistogramDataset) super.clone(); int seriesCount = getSeriesCount(); clone.list = new java.util.ArrayList(seriesCount); for (int i = 0; i < seriesCount; i++) { clone.list.add(new HashMap((Map) this.list.get(i))); } return clone;
XYIntervalSeriesCollection clone = (XYIntervalSeriesCollection) super.clone(); int seriesCount = getSeriesCount(); clone.data = new java.util.ArrayList(seriesCount); for (int i = 0; i < this.data.size(); i++) { clone.data.set(i, getSeries(i).clone()); } return clone;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/statistics/HistogramDataset.java File path: /jfreechart-1.0.10/src/org/jfree/data/xy/XYIntervalSeriesCollection.java
Method name: Object clone() Method name: Object clone()
Number of AST nodes: 6 Number of AST nodes: 6
1
HistogramDataset clone = (HistogramDataset
1
XYIntervalSeriesCollection clone
2
) super.clone();
2
                = (XYIntervalSeriesCollection) super.clone();
3
        int seriesCount = getSeriesCount();
3
        int seriesCount = getSeriesCount();
4
    	clone.list = new java.util.ArrayList(seriesCount);
4
        clone.data = new java.util.ArrayList(seriesCount);
5
        for (int i = 0; i < seriesCount; i++) {
5
        for (int i = 0; i < this.data.size(); i++) {
6
        	clone.list.add(new HashMap((Map) this.list.get(i)));
6
            clone.data.set(i, getSeries(i).clone());
7
        }
7
        }
8
    	return clone;
8
        return clone;
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons12
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)8.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    HistogramDataset clone = (HistogramDataset)super.clone();
    1
    HistogramDataset clone = (HistogramDataset)super.clone();
    1
    XYIntervalSeriesCollection clone = (XYIntervalSeriesCollection)super.clone();
    Differences
    Expression1Expression2Difference
    org.jfree.data.statistics.HistogramDatasetorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.statistics.HistogramDatasetorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.statistics.HistogramDatasetorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Super method call HistogramDataset clone=(HistogramDataset)super.clone(); cannot be extracted from method
    Super method call XYIntervalSeriesCollection clone=(XYIntervalSeriesCollection)super.clone(); cannot be extracted from method
    1
    XYIntervalSeriesCollection clone = (XYIntervalSeriesCollection)super.clone();
    2
    int seriesCount = getSeriesCount();
    2
    int seriesCount = getSeriesCount();
    3
    clone.list = new java.util.ArrayList(seriesCount);
    3
    clone.list = new java.util.ArrayList(seriesCount);
    3
    clone.data = new java.util.ArrayList(seriesCount);
    Differences
    Expression1Expression2Difference
    org.jfree.data.statistics.HistogramDatasetorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    listdataVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression clone.list cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression clone.data cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression clone.list is a field being modified, and thus it cannot be parameterized
    Expression clone.data is a field being modified, and thus it cannot be parameterized
    3
    clone.data = new java.util.ArrayList(seriesCount);
    4
    for (int i = 0; i < seriesCount; i++)
    4
    for (int i = 0; i < seriesCount; i++)
    4
    for (int i = 0; i < this.data.size(); i++)
    Differences
    Expression1Expression2Difference
    seriesCountthis.data.size()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression seriesCount cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    for (int i = 0; i < this.data.size(); i++)
                                                                                        
    5
    clone.data.set(i, getSeries(i).clone());
    Preondition Violations
    Unmatched statement clone.data.set(i,getSeries(i).clone()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement clone.data.set(i,getSeries(i).clone()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    5
    clone.data.set(i, getSeries(i).clone());
    5
    clone.list.add(new HashMap((Map)this.list.get(i)));
    5
    clone.list.add(new HashMap((Map)this.list.get(i)));
    Preondition Violations
    Unmatched statement clone.list.add(new HashMap((Map)this.list.get(i))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                
    6
    return clone;
    6
    return clone;
    6
    return clone;
    Differences
    Expression1Expression2Difference
    org.jfree.data.statistics.HistogramDatasetorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    6
    return clone;
    Precondition Violations (11)
    Row Violation
    1Super method call HistogramDataset clone=(HistogramDataset)super.clone(); cannot be extracted from method
    2Super method call XYIntervalSeriesCollection clone=(XYIntervalSeriesCollection)super.clone(); cannot be extracted from method
    3Expression clone.list cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression clone.data cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression clone.list is a field being modified, and thus it cannot be parameterized
    6Expression clone.data is a field being modified, and thus it cannot be parameterized
    7Expression seriesCount cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Unmatched statement clone.data.set(i,getSeries(i).clone()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement clone.data.set(i,getSeries(i).clone()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    10Unmatched statement clone.list.add(new HashMap((Map)this.list.get(i))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11Clone fragment #1 returns variables clone, i , while Clone fragment #2 returns variables clone, i