if (paint == null) { if (this.backgroundPaint != null) { this.backgroundPaint = null; fireChangeEvent(); } } else { if (this.backgroundPaint != null) { if (this.backgroundPaint.equals(paint)) { return; // nothing to do } } this.backgroundPaint = paint; fireChangeEvent(); }
if (stroke == null) { if (this.outlineStroke != null) { this.outlineStroke = null; fireChangeEvent(); } } else { if (this.outlineStroke != null) { if (this.outlineStroke.equals(stroke)) { return; // nothing to do } } this.outlineStroke = stroke; fireChangeEvent(); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/Plot.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/Plot.java
Method name: void setBackgroundPaint(Paint) Method name: void setOutlineStroke(Stroke)
Number of AST nodes: 9 Number of AST nodes: 9
1
if (paint == null) {
1
if (stroke == null) {
2
            if (this.backgroundPaint != null) {
2
            if (this.outlineStroke != null) {
3
                this.backgroundPaint = null;
3
                this.outlineStroke = null;
4
                fireChangeEvent();
4
                fireChangeEvent();
5
            }
5
            }
6
        }
6
        }
7
        else {
7
        else {
8
            if (this.backgroundPaint != null) {
8
            if (this.outlineStroke != null) {
9
                if (this.backgroundPaint.equals(paint)) {
9
                if (this.outlineStroke.equals(stroke)) {
10
                    return;  // nothing to do
10
                    return;  // nothing to do
11
                }
11
                }
12
            }
12
            }
13
            this.backgroundPaint = paint;
13
            this.outlineStroke = stroke;
14
            fireChangeEvent();
14
            fireChangeEvent();
15
        }
15
        }
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.5
Clones locationClones are declared in the same class
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (paint == null)
    1
    if (paint == null)
    1
    if (stroke == null)
    Differences
    Expression1Expression2Difference
    paintstrokeVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable paint does not match with type java.awt.Stroke of variable stroke
    • Make classes java.awt.Paint and java.awt.Stroke extend a common superclass
    1
    if (stroke == null)
    2
    if (this.backgroundPaint != null)
    2
    if (this.backgroundPaint != null)
    2
    if (this.outlineStroke != null)
    Differences
    Expression1Expression2Difference
    backgroundPaintoutlineStrokeVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable this.backgroundPaint 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
    2
    if (this.outlineStroke != null)
                                                          
    3
    this.outlineStroke = null;
    Preondition Violations
    Unmatched statement this.outlineStroke=null; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    this.outlineStroke = null;
    3
    this.backgroundPaint = null;
    3
    this.backgroundPaint = null;
    Preondition Violations
    Unmatched statement this.backgroundPaint=null; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                              
    4
    fireChangeEvent();
    4
    fireChangeEvent();
    else
    else
    5
    if (this.backgroundPaint != null)
    5
    if (this.backgroundPaint != null)
    5
    if (this.outlineStroke != null)
    Differences
    Expression1Expression2Difference
    backgroundPaintoutlineStrokeVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable this.backgroundPaint 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
    5
    if (this.outlineStroke != null)
    6
    if (this.backgroundPaint.equals(paint))
    6
    if (this.backgroundPaint.equals(paint))
    6
    if (this.outlineStroke.equals(stroke))
    Differences
    Expression1Expression2Difference
    paintstrokeVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    backgroundPaintoutlineStrokeVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable paint does not match with type java.awt.Stroke of variable stroke
    • Make classes java.awt.Paint and java.awt.Stroke extend a common superclass
    Type java.awt.Paint of variable this.backgroundPaint 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
    6
    if (this.outlineStroke.equals(stroke))
    7
    return;
    7
    return;
                                                              
    8
    this.outlineStroke = stroke;
    Preondition Violations
    Unmatched statement this.outlineStroke=stroke; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8
    this.outlineStroke = stroke;
    8
    this.backgroundPaint = paint;
    8
    this.backgroundPaint = paint;
    Preondition Violations
    Unmatched statement this.backgroundPaint=paint; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                
    9
    fireChangeEvent();
    9
    fireChangeEvent();
    Precondition Violations (9)
    Row Violation
    1Type java.awt.Paint of variable paint does not match with type java.awt.Stroke of variable stroke
    2Type java.awt.Paint of variable this.backgroundPaint does not match with type java.awt.Stroke of variable this.outlineStroke
    3Unmatched statement this.outlineStroke=null; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement this.backgroundPaint=null; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Type java.awt.Paint of variable this.backgroundPaint does not match with type java.awt.Stroke of variable this.outlineStroke
    6Type java.awt.Paint of variable paint does not match with type java.awt.Stroke of variable stroke
    7Type java.awt.Paint of variable this.backgroundPaint does not match with type java.awt.Stroke of variable this.outlineStroke
    8Unmatched statement this.outlineStroke=stroke; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9Unmatched statement this.backgroundPaint=paint; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted