Paint result = getSectionPaint(); if (result != null) { return result; } // if not, check if there is a paint defined for the specified key result = this.sectionPaintMap.getPaint(key); if (result != null) { return result; } // nothing defined - do we autoPopulate? if (autoPopulate) { DrawingSupplier ds = getDrawingSupplier(); if (ds != null) { result = ds.getNextPaint(); this.sectionPaintMap.put(key, result); } else { result = this.baseSectionPaint; } } else { result = this.baseSectionPaint; } return result;
Stroke result = getSectionOutlineStroke(); if (result != null) { return result; } // if not, check if there is a stroke defined for the specified key result = this.sectionOutlineStrokeMap.getStroke(key); if (result != null) { return result; } // nothing defined - do we autoPopulate? if (autoPopulate) { DrawingSupplier ds = getDrawingSupplier(); if (ds != null) { result = ds.getNextOutlineStroke(); this.sectionOutlineStrokeMap.put(key, result); } else { result = this.baseSectionOutlineStroke; } } else { result = this.baseSectionOutlineStroke; } 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/PiePlot.java
Method name: Paint lookupSectionPaint(Comparable, boolean) Method name: Stroke lookupSectionOutlineStroke(Comparable, boolean)
Number of AST nodes: 14 Number of AST nodes: 14
1
Paint result = getSectionPaint();
1
Stroke result = getSectionOutlineStroke();
2
        if (result != null) {
2
        if (result != null) {
3
            return result;
3
            return result;
4
        }
4
        }
5
        
5
        
6
        // if not, check if there is a paint defined for the specified key
6
        // if not, check if there is a stroke defined for the specified key
7
        result = this.sectionPaintMap.getPaint(key);
7
        result = this.sectionOutlineStrokeMap.getStroke(key);
8
        if (result != null) {
8
        if (result != null) {
9
            return result;
9
            return result;
10
        }
10
        }
11
        
11
        
12
        // nothing defined - do we autoPopulate?
12
        // nothing defined - do we autoPopulate?
13
        if (autoPopulate) {
13
        if (autoPopulate) {
14
            DrawingSupplier ds = getDrawingSupplier();
14
            DrawingSupplier ds = getDrawingSupplier();
15
            if (ds != null) {
15
            if (ds != null) {
16
                result = ds.getNextPaint();
16
                result = ds.getNextOutlineStroke();
17
                this.sectionPaintMap.put(key, result);
17
                this.sectionOutlineStrokeMap.put(key, result);
18
            }
18
            }
19
            else {
19
            else {
20
                result = this.baseSectionPaint;
20
                result = this.baseSectionOutlineStroke;
21
            }
21
            }
22
        }
22
        }
23
        else {
23
        else {
24
            result = this.baseSectionPaint;
24
            result = this.baseSectionOutlineStroke;
25
        }
25
        }
26
        return result;
26
        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.4
Clones locationClones are declared in the same class
Number of node comparisons47
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment8
    Number of unmapped statements in the second code fragment8
    Time elapsed for statement mapping (ms)20.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                          
    1
    Stroke result = getSectionOutlineStroke();
    1
    Paint result = getSectionPaint();
                                                                        
    2
    if (result != null)
    2
    if (result != null)
    2
    if (result != null)
    Differences
    Expression1Expression2Difference
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable result does not match with type java.awt.Stroke of variable result
    • Make classes java.awt.Paint and java.awt.Stroke extend a common superclass
    2
    if (result != null)
                                      
    3
    return result;
    Preondition Violations
    Unmatched statement return result; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return result;
    3
    return result;
    3
    return result;
    3
    return result;
    Preondition Violations
    Unmatched statement return result; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return result;
                                      
                                                                                                                
    4
    result = this.sectionOutlineStrokeMap.getStroke(key);
    Preondition Violations
    Unmatched statement result=this.sectionOutlineStrokeMap.getStroke(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    result = this.sectionOutlineStrokeMap.getStroke(key);
    4
    result = this.sectionPaintMap.getPaint(key);
    4
    result = this.sectionPaintMap.getPaint(key);
    Preondition Violations
    Unmatched statement result=this.sectionPaintMap.getPaint(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                              
    5
    if (result != null)
    5
    if (result != null)
    5
    if (result != null)
    Differences
    Expression1Expression2Difference
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable result does not match with type java.awt.Stroke of variable result
    • Make classes java.awt.Paint and java.awt.Stroke extend a common superclass
    5
    if (result != null)
                                      
    6
    return result;
    Preondition Violations
    Unmatched statement return result; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return result;
    6
    return result;
    6
    return result;
    6
    return result;
    Preondition Violations
    Unmatched statement return result; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return result;
                                      
    7
    if (autoPopulate)
    7
    if (autoPopulate)
    8
    DrawingSupplier ds = getDrawingSupplier();
    8
    DrawingSupplier ds = getDrawingSupplier();
    9
    if (ds != null)
    9
    if (ds != null)
                                                                              
    10
    result = ds.getNextOutlineStroke();
    Preondition Violations
    Unmatched statement result=ds.getNextOutlineStroke(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    result = ds.getNextOutlineStroke();
    10
    result = ds.getNextPaint();
    10
    result = ds.getNextPaint();
    Preondition Violations
    Unmatched statement result=ds.getNextPaint(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                              
    11
    this.sectionPaintMap.put(key, result);
    11
    this.sectionPaintMap.put(key, result);
    11
    this.sectionOutlineStrokeMap.put(key, result);
    Differences
    Expression1Expression2Difference
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    sectionPaintMapsectionOutlineStrokeMapVARIABLE_NAME_MISMATCH
    org.jfree.chart.PaintMaporg.jfree.chart.StrokeMapVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable result does not match with type java.awt.Stroke of variable result
    • Make classes java.awt.Paint and java.awt.Stroke extend a common superclass
    Expression this.sectionPaintMap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.sectionOutlineStrokeMap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.chart.PaintMap of variable this.sectionPaintMap does not match with type org.jfree.chart.StrokeMap of variable this.sectionOutlineStrokeMap
    • Make classes org.jfree.chart.PaintMap and org.jfree.chart.StrokeMap extend a common superclass
    11
    this.sectionOutlineStrokeMap.put(key, result);
    else
            
                                                                                      
    12
    result = this.baseSectionOutlineStroke;
    Preondition Violations
    Unmatched statement result=this.baseSectionOutlineStroke; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12
    result = this.baseSectionOutlineStroke;
    12
    result = this.baseSectionPaint;
    12
    result = this.baseSectionPaint;
    Preondition Violations
    Unmatched statement result=this.baseSectionPaint; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                      
    else
            
                                                                                      
    13
    result = this.baseSectionOutlineStroke;
    Preondition Violations
    Unmatched statement result=this.baseSectionOutlineStroke; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13
    result = this.baseSectionOutlineStroke;
    13
    result = this.baseSectionPaint;
    13
    result = this.baseSectionPaint;
    Preondition Violations
    Unmatched statement result=this.baseSectionPaint; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                      
                                        
    14
    return result;
    Preondition Violations
    Unmatched return result;
    14
    return result;
    14
    return result;
    14
    return result;
    Preondition Violations
    Unmatched return result;
                                        
    Precondition Violations (24)
    Row Violation
    1Type java.awt.Paint of variable result does not match with type java.awt.Stroke of variable result
    2Unmatched statement return result; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched return result;
    4Unmatched statement return result; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched return result;
    6Unmatched statement result=this.sectionOutlineStrokeMap.getStroke(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement result=this.sectionPaintMap.getPaint(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Type java.awt.Paint of variable result does not match with type java.awt.Stroke of variable result
    9Unmatched statement return result; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10Unmatched return result;
    11Unmatched statement return result; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    12Unmatched return result;
    13Unmatched statement result=ds.getNextOutlineStroke(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14Unmatched statement result=ds.getNextPaint(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    15Type java.awt.Paint of variable result does not match with type java.awt.Stroke of variable result
    16Expression this.sectionPaintMap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression this.sectionOutlineStrokeMap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Type org.jfree.chart.PaintMap of variable this.sectionPaintMap does not match with type org.jfree.chart.StrokeMap of variable this.sectionOutlineStrokeMap
    19Unmatched statement result=this.baseSectionOutlineStroke; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    20Unmatched statement result=this.baseSectionPaint; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    21Unmatched statement result=this.baseSectionOutlineStroke; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    22Unmatched statement result=this.baseSectionPaint; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    23Unmatched return result;
    24Unmatched return result;