if (obj == this) { return true; } if (!(obj instanceof DialBackground)) { return false; } DialBackground that = (DialBackground) obj; if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!this.gradientPaintTransformer.equals( that.gradientPaintTransformer)) { return false; } return super.equals(obj);
if (obj == this) { return true; } if (!(obj instanceof XYAreaRenderer2)) { return false; } XYAreaRenderer2 that = (XYAreaRenderer2) obj; if (this.showOutline != that.showOutline) { return false; } if (!ShapeUtilities.equal(this.legendArea, that.legendArea)) { return false; } return super.equals(obj);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/dial/DialBackground.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYAreaRenderer2.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 10 Number of AST nodes: 10
1
if (obj == this) {
1
if (obj == this) {    
2
            return true;
2
            return true;
3
        }
3
        }
4
        if (!(obj instanceof DialBackground)) {
4
        if (!(obj instanceof XYAreaRenderer2)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        DialBackground that = (DialBackground) obj;
7
        
8
        if (!PaintUtilities.equal(this.paint, that.paint)
8
XYAreaRenderer2 that = (XYAreaRenderer2) obj;
9
) {
9
        if (this.showOutline != that.showOutline) {
10
            return false;
10
            return false;
11
        }
11
        }
12
        if (!this.gradientPaintTransformer.equals(
12
        if (!
13
                that.gradientPaintTransformer)) {
13
ShapeUtilities.equal(this.legendArea, that.legendArea)) {
14
            return false;
14
            return false;
15
        }
15
        }
16
        return super.equals(obj);
16
        return super.equals(obj);
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)1.2
Clones locationClones are in different classes
Number of node comparisons29
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)3.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj == this)
    1
    if (obj == this)
    2
    return true;
    2
    return true;
    3
    if (!(obj instanceof DialBackground))
    3
    if (!(obj instanceof DialBackground))
    3
    if (!(obj instanceof XYAreaRenderer2))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.dial.DialBackgroundorg.jfree.chart.renderer.xy.XYAreaRenderer2SUBCLASS_TYPE_MISMATCH
    3
    if (!(obj instanceof XYAreaRenderer2))
    4
    return false;
    4
    return false;
    5
    DialBackground that = (DialBackground)obj;
    5
    DialBackground that = (DialBackground)obj;
    5
    XYAreaRenderer2 that = (XYAreaRenderer2)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.dial.DialBackgroundorg.jfree.chart.renderer.xy.XYAreaRenderer2SUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.dial.DialBackgroundorg.jfree.chart.renderer.xy.XYAreaRenderer2SUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.dial.DialBackgroundorg.jfree.chart.renderer.xy.XYAreaRenderer2SUBCLASS_TYPE_MISMATCH
    5
    XYAreaRenderer2 that = (XYAreaRenderer2)obj;
                                                                                          
    6
    if (this.showOutline != that.showOutline)
    Preondition Violations
    Unmatched statement if(this.showOutline != that.showOutline) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    if (this.showOutline != that.showOutline)
                                    
    7
    return false;
    Preondition Violations
    Unmatched return false;
    7
    return false;
    6
    if (!PaintUtilities.equal(this.paint, that.paint))
    6
    if (!PaintUtilities.equal(this.paint, that.paint))
    8
    if (!ShapeUtilities.equal(this.legendArea, that.legendArea))
    Differences
    Expression1Expression2Difference
    paintlegendAreaVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.ShapeVARIABLE_TYPE_MISMATCH
    org.jfree.chart.plot.dial.DialBackgroundorg.jfree.chart.renderer.xy.XYAreaRenderer2SUBCLASS_TYPE_MISMATCH
    paintlegendAreaVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.ShapeVARIABLE_TYPE_MISMATCH
    org.jfree.util.PaintUtilitiesorg.jfree.util.ShapeUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable this.paint does not match with type java.awt.Shape of variable this.legendArea
    • Make classes java.awt.Paint and java.awt.Shape extend a common superclass
    Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.legendArea cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Paint of variable that.paint does not match with type java.awt.Shape of variable that.legendArea
    • Make classes java.awt.Paint and java.awt.Shape extend a common superclass
    Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ShapeUtilities
    • Make classes org.jfree.util.PaintUtilities and org.jfree.util.ShapeUtilities extend a common superclass
    8
    if (!ShapeUtilities.equal(this.legendArea, that.legendArea))
    7
    return false;
    9
    return false;
    Precondition Violations (10)
    Row Violation
    1Unmatched statement if(this.showOutline != that.showOutline) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched return false;
    3Type java.awt.Paint of variable this.paint does not match with type java.awt.Shape of variable this.legendArea
    4Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.legendArea cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type java.awt.Paint of variable that.paint does not match with type java.awt.Shape of variable that.legendArea
    7Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ShapeUtilities
    8Clone fragment #1 returns variable that with type org.jfree.chart.plot.dial.DialBackground , while Clone fragment #2 returns variable that with type org.jfree.chart.renderer.xy.XYAreaRenderer2
    9Not all possible execution flows end in a return statement
    10The refactoring of the clones is infeasible, because classes org.jfree.chart.plot.dial.DialBackground and org.jfree.chart.renderer.xy.XYAreaRenderer2 do not have a common superclass