if (this.outlinePaint != null) { return this.outlinePaint; } // otherwise look up the paint table Paint seriesOutlinePaint = getSeriesOutlinePaint(series); if (seriesOutlinePaint == null && this.autoPopulateSeriesOutlinePaint) { DrawingSupplier supplier = getDrawingSupplier(); if (supplier != null) { seriesOutlinePaint = supplier.getNextOutlinePaint(); setSeriesOutlinePaint(series, seriesOutlinePaint, false); } } if (seriesOutlinePaint == null) { seriesOutlinePaint = this.baseOutlinePaint; } return seriesOutlinePaint;
if (this.stroke != null) { return this.stroke; } // otherwise look up the paint table Stroke result = getSeriesStroke(series); if (result == null && this.autoPopulateSeriesStroke) { DrawingSupplier supplier = getDrawingSupplier(); if (supplier != null) { result = supplier.getNextStroke(); setSeriesStroke(series, result, false); } } if (result == null) { result = this.baseStroke; } return result;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/AbstractRenderer.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/AbstractRenderer.java
Method name: Paint lookupSeriesOutlinePaint(int) Method name: Stroke lookupSeriesStroke(int)
Number of AST nodes: 11 Number of AST nodes: 11
1
if (this.outlinePaint != null) {
1
if (this.stroke != null) {
2
            return this.outlinePaint;
2
            return this.stroke;
3
        }
3
        }
4
        // otherwise look up the paint table
4
        // otherwise look up the paint table
5
        Paint seriesOutlinePaint = getSeriesOutlinePaint(series);
5
        Stroke result = getSeriesStroke(series);
6
        if (seriesOutlinePaint == null && this.autoPopulateSeriesOutlinePaint) {
6
        if (result == null && this.autoPopulateSeriesStroke) {
7
            DrawingSupplier supplier = getDrawingSupplier();
7
            DrawingSupplier supplier = getDrawingSupplier();
8
            if (supplier != null) {
8
            if (supplier != null) {
9
                seriesOutlinePaint = supplier.getNextOutlinePaint();
9
                result = supplier.getNextStroke();
10
                setSeriesOutlinePaint(series, seriesOutlinePaint, false);
10
                setSeriesStroke(series, result, false);
11
            }
11
            }
12
        }
12
        }
13
        if (seriesOutlinePaint == null) {
13
        if (result == null) {
14
            seriesOutlinePaint = this.baseOutlinePaint;
14
            result = this.baseStroke;
15
        }
15
        }
16
        return seriesOutlinePaint;
16
        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.6
Clones locationClones are declared in the same class
Number of node comparisons27
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment6
    Number of unmapped statements in the second code fragment6
    Time elapsed for statement mapping (ms)3.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (this.outlinePaint != null)
    1
    if (this.outlinePaint != null)
    1
    if (this.stroke != null)
    Differences
    Expression1Expression2Difference
    outlinePaintstrokeVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable this.outlinePaint does not match with type java.awt.Stroke of variable this.stroke
    • Make classes java.awt.Paint and java.awt.Stroke extend a common superclass
    1
    if (this.stroke != null)
                                                
    2
    return this.stroke;
    Preondition Violations
    Unmatched statement return this.stroke; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return this.stroke;
    2
    return this.stroke;
    2
    return this.outlinePaint;
    2
    return this.outlinePaint;
    Preondition Violations
    Unmatched statement return this.outlinePaint; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return this.outlinePaint;
                                                            
                                                                                      
    3
    Stroke result = getSeriesStroke(series);
    3
    Paint seriesOutlinePaint = getSeriesOutlinePaint(series);
                                                                                                                        
    4
    if (seriesOutlinePaint == null && this.autoPopulateSeriesOutlinePaint)
    4
    if (seriesOutlinePaint == null && this.autoPopulateSeriesOutlinePaint)
    4
    if (result == null && this.autoPopulateSeriesStroke)
    Differences
    Expression1Expression2Difference
    seriesOutlinePaintresultVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    autoPopulateSeriesOutlinePaintautoPopulateSeriesStrokeVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable seriesOutlinePaint does not match with type java.awt.Stroke of variable result
    • Make classes java.awt.Paint and java.awt.Stroke extend a common superclass
    4
    if (result == null && this.autoPopulateSeriesStroke)
    5
    DrawingSupplier supplier = getDrawingSupplier();
    5
    DrawingSupplier supplier = getDrawingSupplier();
    6
    if (supplier != null)
    6
    if (supplier != null)
                                                                          
    7
    result = supplier.getNextStroke();
    Preondition Violations
    Unmatched statement result=supplier.getNextStroke(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    result = supplier.getNextStroke();
    7
    seriesOutlinePaint = supplier.getNextOutlinePaint();
    7
    seriesOutlinePaint = supplier.getNextOutlinePaint();
    Preondition Violations
    Unmatched statement seriesOutlinePaint=supplier.getNextOutlinePaint(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                              
                                                                                    
    8
    setSeriesStroke(series, result, false);
    Preondition Violations
    Unmatched statement setSeriesStroke(series,result,false); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8
    setSeriesStroke(series, result, false);
    8
    setSeriesOutlinePaint(series, seriesOutlinePaint, false);
    8
    setSeriesOutlinePaint(series, seriesOutlinePaint, false);
    Preondition Violations
    Unmatched statement setSeriesOutlinePaint(series,seriesOutlinePaint,false); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                        
    9
    if (seriesOutlinePaint == null)
    9
    if (seriesOutlinePaint == null)
    9
    if (result == null)
    Differences
    Expression1Expression2Difference
    seriesOutlinePaintresultVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable seriesOutlinePaint does not match with type java.awt.Stroke of variable result
    • Make classes java.awt.Paint and java.awt.Stroke extend a common superclass
    9
    if (result == null)
                                                          
    10
    result = this.baseStroke;
    Preondition Violations
    Unmatched statement result=this.baseStroke; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    result = this.baseStroke;
    10
    seriesOutlinePaint = this.baseOutlinePaint;
    10
    seriesOutlinePaint = this.baseOutlinePaint;
    Preondition Violations
    Unmatched statement seriesOutlinePaint=this.baseOutlinePaint; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                              
                                        
    11
    return result;
    Preondition Violations
    Unmatched return result;
    11
    return result;
    11
    return seriesOutlinePaint;
    11
    return seriesOutlinePaint;
    Preondition Violations
    Unmatched return seriesOutlinePaint;
                                                                
    Precondition Violations (15)
    Row Violation
    1Type java.awt.Paint of variable this.outlinePaint does not match with type java.awt.Stroke of variable this.stroke
    2Unmatched statement return this.stroke; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched return this.stroke;
    4Unmatched statement return this.outlinePaint; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched return this.outlinePaint;
    6Type java.awt.Paint of variable seriesOutlinePaint does not match with type java.awt.Stroke of variable result
    7Unmatched statement result=supplier.getNextStroke(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement seriesOutlinePaint=supplier.getNextOutlinePaint(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement setSeriesStroke(series,result,false); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10Unmatched statement setSeriesOutlinePaint(series,seriesOutlinePaint,false); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    11Type java.awt.Paint of variable seriesOutlinePaint does not match with type java.awt.Stroke of variable result
    12Unmatched statement result=this.baseStroke; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13Unmatched statement seriesOutlinePaint=this.baseOutlinePaint; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14Unmatched return result;
    15Unmatched return seriesOutlinePaint;