if (this.backgroundPaint != null) { if (!this.backgroundPaint.equals(paint)) { this.backgroundPaint = paint; fireChartChanged(); } } else { if (paint != null) { this.backgroundPaint = paint; fireChartChanged(); } }
if (this.backgroundImage != null) { if (!this.backgroundImage.equals(image)) { this.backgroundImage = image; fireChartChanged(); } } else { if (image != null) { this.backgroundImage = image; fireChartChanged(); } }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/JFreeChart.java File path: /jfreechart-1.0.10/src/org/jfree/chart/JFreeChart.java
Method name: void setBackgroundPaint(Paint) Method name: void setBackgroundImage(Image)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (this.backgroundPaint != null) {
1
if (this.backgroundImage != null) {
2
            if (!this.backgroundPaint.equals(paint)) {
2
            if (!this.backgroundImage.equals(image)) {
3
                this.backgroundPaint = paint;
3
                this.backgroundImage = image;
4
                fireChartChanged();
4
                fireChartChanged();
5
            }
5
            }
6
        }
6
        }
7
        else {
7
        else {
8
            if (paint != null) {
8
            if (image != null) {
9
                this.backgroundPaint = paint;
9
                this.backgroundImage = image;
10
                fireChartChanged();
10
                fireChartChanged();
11
            }
11
            }
12
        }
12
        }
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 comparisons21
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (this.backgroundPaint != null)
    1
    if (this.backgroundPaint != null)
    1
    if (this.backgroundImage != null)
    Differences
    Expression1Expression2Difference
    backgroundPaintbackgroundImageVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.ImageVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable this.backgroundPaint does not match with type java.awt.Image of variable this.backgroundImage
    • Make classes java.awt.Paint and java.awt.Image extend a common superclass
    1
    if (this.backgroundImage != null)
    2
    if (!this.backgroundPaint.equals(paint))
    2
    if (!this.backgroundPaint.equals(paint))
    2
    if (!this.backgroundImage.equals(image))
    Differences
    Expression1Expression2Difference
    paintimageVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.ImageVARIABLE_TYPE_MISMATCH
    backgroundPaintbackgroundImageVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.ImageVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable paint does not match with type java.awt.Image of variable image
    • Make classes java.awt.Paint and java.awt.Image extend a common superclass
    Type java.awt.Paint of variable this.backgroundPaint does not match with type java.awt.Image of variable this.backgroundImage
    • Make classes java.awt.Paint and java.awt.Image extend a common superclass
    2
    if (!this.backgroundImage.equals(image))
                                                                
    3
    this.backgroundImage = image;
    Preondition Violations
    Unmatched statement this.backgroundImage=image; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    this.backgroundImage = image;
    3
    this.backgroundPaint = paint;
    3
    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
                                                                
    4
    fireChartChanged();
    4
    fireChartChanged();
    else
    else
    5
    if (paint != null)
    5
    if (paint != null)
    5
    if (image != null)
    Differences
    Expression1Expression2Difference
    paintimageVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.ImageVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable paint does not match with type java.awt.Image of variable image
    • Make classes java.awt.Paint and java.awt.Image extend a common superclass
    5
    if (image != null)
                                                                
    6
    this.backgroundImage = image;
    Preondition Violations
    Unmatched statement this.backgroundImage=image; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6
    this.backgroundImage = image;
    6
    this.backgroundPaint = paint;
    6
    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
                                                                
    7
    fireChartChanged();
    7
    fireChartChanged();
    Precondition Violations (8)
    Row Violation
    1Type java.awt.Paint of variable this.backgroundPaint does not match with type java.awt.Image of variable this.backgroundImage
    2Type java.awt.Paint of variable paint does not match with type java.awt.Image of variable image
    3Type java.awt.Paint of variable this.backgroundPaint does not match with type java.awt.Image of variable this.backgroundImage
    4Unmatched statement this.backgroundImage=image; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement this.backgroundPaint=paint; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Type java.awt.Paint of variable paint does not match with type java.awt.Image of variable image
    7Unmatched statement this.backgroundImage=image; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8Unmatched statement this.backgroundPaint=paint; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted