if (this.fillPaint != null) { return this.fillPaint; } // otherwise look up the paint table Paint seriesFillPaint = getSeriesFillPaint(series); if (seriesFillPaint == null && this.autoPopulateSeriesFillPaint) { DrawingSupplier supplier = getDrawingSupplier(); if (supplier != null) { seriesFillPaint = supplier.getNextFillPaint(); setSeriesFillPaint(series, seriesFillPaint, false); } } if (seriesFillPaint == null) { seriesFillPaint = this.baseFillPaint; } return seriesFillPaint;
if (this.outlineStroke != null) { return this.outlineStroke; } // otherwise look up the stroke table Stroke result = getSeriesOutlineStroke(series); if (result == null && this.autoPopulateSeriesOutlineStroke) { DrawingSupplier supplier = getDrawingSupplier(); if (supplier != null) { result = supplier.getNextOutlineStroke(); setSeriesOutlineStroke(series, result, false); } } if (result == null) { result = this.baseOutlineStroke; } 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 lookupSeriesFillPaint(int) Method name: Stroke lookupSeriesOutlineStroke(int)
Number of AST nodes: 11 Number of AST nodes: 11
1
if (this.fillPaint != null) {
1
if (this.outlineStroke != null) {
2
            return this.fillPaint;
2
            return this.outlineStroke;
3
        }
3
        }
4
        // otherwise look up the paint table
4
        // otherwise look up the stroke table
5
        Paint seriesFillPaint = getSeriesFillPaint(series);
5
        Stroke result = getSeriesOutlineStroke(series);
6
        if (seriesFillPaint == null && this.autoPopulateSeriesFillPaint) {
6
        if (result == null && this.autoPopulateSeriesOutlineStroke) {
7
            DrawingSupplier supplier = getDrawingSupplier();
7
            DrawingSupplier supplier = getDrawingSupplier();
8
            if (supplier != null) {
8
            if (supplier != null) {
9
                seriesFillPaint = supplier.getNextFillPaint();
9
                result = supplier.getNextOutlineStroke();
10
                setSeriesFillPaint(series, seriesFillPaint, false);
10
                setSeriesOutlineStroke(series, result, false);
11
            }
11
            }
12
        }
12
        }
13
        if (seriesFillPaint == null) {
13
        if (result == null) {
14
            seriesFillPaint = this.baseFillPaint;
14
            result = this.baseOutlineStroke;
15
        }
15
        }
16
        return seriesFillPaint;
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.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (this.fillPaint != null)
    1
    if (this.fillPaint != null)
    1
    if (this.outlineStroke != null)
    Differences
    Expression1Expression2Difference
    fillPaintoutlineStrokeVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable this.fillPaint does not match with type java.awt.Stroke of variable this.outlineStroke
    • Make classes java.awt.Paint and java.awt.Stroke extend a common superclass
    1
    if (this.outlineStroke != null)
                                                              
    2
    return this.outlineStroke;
    Preondition Violations
    Unmatched statement return this.outlineStroke; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return this.outlineStroke;
    2
    return this.outlineStroke;
    2
    return this.fillPaint;
    2
    return this.fillPaint;
    Preondition Violations
    Unmatched statement return this.fillPaint; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return this.fillPaint;
                                                      
                                                                                                    
    3
    Stroke result = getSeriesOutlineStroke(series);
    3
    Paint seriesFillPaint = getSeriesFillPaint(series);
                                                                                                            
    4
    if (seriesFillPaint == null && this.autoPopulateSeriesFillPaint)
    4
    if (seriesFillPaint == null && this.autoPopulateSeriesFillPaint)
    4
    if (result == null && this.autoPopulateSeriesOutlineStroke)
    Differences
    Expression1Expression2Difference
    seriesFillPaintresultVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    autoPopulateSeriesFillPaintautoPopulateSeriesOutlineStrokeVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable seriesFillPaint 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.autoPopulateSeriesOutlineStroke)
    5
    DrawingSupplier supplier = getDrawingSupplier();
    5
    DrawingSupplier supplier = getDrawingSupplier();
    6
    if (supplier != null)
    6
    if (supplier != null)
                                                                                        
    7
    result = supplier.getNextOutlineStroke();
    Preondition Violations
    Unmatched statement result=supplier.getNextOutlineStroke(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    result = supplier.getNextOutlineStroke();
    7
    seriesFillPaint = supplier.getNextFillPaint();
    7
    seriesFillPaint = supplier.getNextFillPaint();
    Preondition Violations
    Unmatched statement seriesFillPaint=supplier.getNextFillPaint(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                  
                                                                                                  
    8
    setSeriesOutlineStroke(series, result, false);
    Preondition Violations
    Unmatched statement setSeriesOutlineStroke(series,result,false); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8
    setSeriesOutlineStroke(series, result, false);
    8
    setSeriesFillPaint(series, seriesFillPaint, false);
    8
    setSeriesFillPaint(series, seriesFillPaint, false);
    Preondition Violations
    Unmatched statement setSeriesFillPaint(series,seriesFillPaint,false); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                            
    9
    if (seriesFillPaint == null)
    9
    if (seriesFillPaint == null)
    9
    if (result == null)
    Differences
    Expression1Expression2Difference
    seriesFillPaintresultVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable seriesFillPaint 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.baseOutlineStroke;
    Preondition Violations
    Unmatched statement result=this.baseOutlineStroke; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    result = this.baseOutlineStroke;
    10
    seriesFillPaint = this.baseFillPaint;
    10
    seriesFillPaint = this.baseFillPaint;
    Preondition Violations
    Unmatched statement seriesFillPaint=this.baseFillPaint; 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 seriesFillPaint;
    11
    return seriesFillPaint;
    Preondition Violations
    Unmatched return seriesFillPaint;
                                                          
    Precondition Violations (15)
    Row Violation
    1Type java.awt.Paint of variable this.fillPaint does not match with type java.awt.Stroke of variable this.outlineStroke
    2Unmatched statement return this.outlineStroke; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched return this.outlineStroke;
    4Unmatched statement return this.fillPaint; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched return this.fillPaint;
    6Type java.awt.Paint of variable seriesFillPaint does not match with type java.awt.Stroke of variable result
    7Unmatched statement result=supplier.getNextOutlineStroke(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement seriesFillPaint=supplier.getNextFillPaint(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement setSeriesOutlineStroke(series,result,false); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10Unmatched statement setSeriesFillPaint(series,seriesFillPaint,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 seriesFillPaint does not match with type java.awt.Stroke of variable result
    12Unmatched statement result=this.baseOutlineStroke; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13Unmatched statement seriesFillPaint=this.baseFillPaint; 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 seriesFillPaint;