while (iterator.hasNext()) { Comparable key = (Comparable) iterator.next(); Number explode = (Number) this.explodePercentages.get(key); if (explode != null) { result = Math.max(result, explode.doubleValue()); } }
DialScale result = (DialScale) this.scales.get(0); Integer scaleIndex = (Integer) this.datasetToScaleMap.get(datasetIndex); if (scaleIndex != null) { result = getScale(scaleIndex.intValue()); } return result;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/PiePlot.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/dial/DialPlot.java
Method name: double getMaximumExplodePercent() Method name: DialScale getScaleForDataset(int)
Number of AST nodes: 5 Number of AST nodes: 5
1
while (iterator.hasNext()) {
2
            Comparable key = (Comparable) iterator.next();
1
DialScale result = (DialScale) this.scales.get(0);    
3
            Number explode = (Number) this.explodePercentages.get(key);
2
        Integer scaleIndex = (Integer) this.
4
    
3
datasetToScaleMap.get(datasetIndex);
5
        if (explode != null) {
4
        if (scaleIndex != null) {
6
                result = Math.max(result, explode.doubleValue());   
5
            result = 
7
    
6
getScale(scaleIndex.intValue());
8
        }
7
        }
9
        }
8
        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.1
Clones locationClones are in different classes having the same super class
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)5.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                        
    1
    DialScale result = (DialScale)this.scales.get(0);
    6
    Comparable key = (Comparable)iterator.next();
    6
    Comparable key = (Comparable)iterator.next();
    Preondition Violations
    Unmatched statement Comparable key=(Comparable)iterator.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                
    7
    Number explode = (Number)this.explodePercentages.get(key);
    7
    Number explode = (Number)this.explodePercentages.get(key);
    2
    Integer scaleIndex = (Integer)this.datasetToScaleMap.get(datasetIndex);
    Differences
    Expression1Expression2Difference
    java.lang.Numberjava.lang.IntegerSUBCLASS_TYPE_MISMATCH
    explodescaleIndexVARIABLE_NAME_MISMATCH
    java.lang.Numberjava.lang.IntegerSUBCLASS_TYPE_MISMATCH
    java.lang.Numberjava.lang.IntegerSUBCLASS_TYPE_MISMATCH
    keydatasetIndexVARIABLE_NAME_MISMATCH
    java.lang.ComparableintVARIABLE_TYPE_MISMATCH
    explodePercentagesdatasetToScaleMapVARIABLE_NAME_MISMATCH
    java.util.Maporg.jfree.util.ObjectListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression (Number)this.explodePercentages.get(key) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.Comparable of variable key does not match with type int of variable datasetIndex
    Type java.util.Map of variable this.explodePercentages does not match with type org.jfree.util.ObjectList of variable this.datasetToScaleMap
    • Make classes java.util.Map and org.jfree.util.ObjectList extend a common superclass
    2
    Integer scaleIndex = (Integer)this.datasetToScaleMap.get(datasetIndex);
    8
    if (explode != null)
    8
    if (explode != null)
    3
    if (scaleIndex != null)
    Differences
    Expression1Expression2Difference
    explodescaleIndexVARIABLE_NAME_MISMATCH
    java.lang.Numberjava.lang.IntegerSUBCLASS_TYPE_MISMATCH
    3
    if (scaleIndex != null)
                                                                                        
    4
    result = getScale(scaleIndex.intValue());
    Preondition Violations
    Unmatched statement result=getScale(scaleIndex.intValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    result = getScale(scaleIndex.intValue());
    9
    result = Math.max(result, explode.doubleValue());
    9
    result = Math.max(result, explode.doubleValue());
    Preondition Violations
    Unmatched statement result=Math.max(result,explode.doubleValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                      
                                      
    5
    return result;
    Preondition Violations
    Unmatched return result;
    5
    return result;
    Precondition Violations (8)
    Row Violation
    1Unmatched statement Comparable key=(Comparable)iterator.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression (Number)this.explodePercentages.get(key) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type java.lang.Comparable of variable key does not match with type int of variable datasetIndex
    4Type java.util.Map of variable this.explodePercentages does not match with type org.jfree.util.ObjectList of variable this.datasetToScaleMap
    5Unmatched statement result=getScale(scaleIndex.intValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement result=Math.max(result,explode.doubleValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched return result;
    8Clone fragment #1 returns variable explode with type java.lang.Number , while Clone fragment #2 returns variable scaleIndex with type java.lang.Integer