if (obj == this) { return true; } if (!(obj instanceof XYBoxAndWhiskerRenderer)) { return false; } if (!super.equals(obj)) { return false; } XYBoxAndWhiskerRenderer that = (XYBoxAndWhiskerRenderer) obj; if (this.boxWidth != that.getBoxWidth()) { return false; } if (!PaintUtilities.equal(this.boxPaint, that.boxPaint)) { return false; } if (!PaintUtilities.equal(this.artifactPaint, that.artifactPaint)) { return false; } if (this.fillBox != that.fillBox) { return false; } return true;
if (object == this) { return true; } if (!(object instanceof Task)) { return false; } Task that = (Task) object; if (!ObjectUtilities.equal(this.description, that.description)) { return false; } if (!ObjectUtilities.equal(this.duration, that.duration)) { return false; } if (!ObjectUtilities.equal(this.percentComplete, that.percentComplete)) { return false; } if (!ObjectUtilities.equal(this.subtasks, that.subtasks)) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYBoxAndWhiskerRenderer.java File path: /jfreechart-1.0.10/src/org/jfree/data/gantt/Task.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 16 Number of AST nodes: 14
1
if (obj == this) {
1
if (object == this) {
2
            return true;
2
            return true;
3
        }
3
        }
4
        if (!(obj instanceof XYBoxAndWhiskerRenderer)) {
4
        if (!(object instanceof Task)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        if (!super.equals(obj)) {
7
        
8
            return false;
9
        }
10
        XYBoxAndWhiskerRenderer that = (XYBoxAndWhiskerRenderer) obj;
8
Task that = (Task) object;
11
        if (this.boxWidth != that.getBoxWidth()) {
9
        if (!ObjectUtilities.equal(this.description, that.description)) {
12
            return false;
10
            return false;
13
        }
11
        }
14
        if (!PaintUtilities.equal(this.boxPaint, that.boxPaint)) {
12
        if (!ObjectUtilities.equal(this.duration, that.duration)) {
15
            return false;
13
            return false;
16
        }
14
        }
17
        if (!PaintUtilities.equal(this.artifactPaint, that.artifactPaint
15
        if (!ObjectUtilities.equal(this.percentComplete, 
18
)) {
16
                that.percentComplete)) {
19
            return false;
17
            return false;
20
        }
18
        }
21
        if (this.fillBox != that.fillBox) {
19
        if (!ObjectUtilities.equal(this.subtasks, that.subtasks)) {
22
            return false;
20
            return false;
23
        }
21
        }
24
        return true;
22
        return true;
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)4.0
Clones locationClones are in different classes
Number of node comparisons76
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)4.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj == this)
    1
    if (obj == this)
    1
    if (object == this)
    Differences
    Expression1Expression2Difference
    objobjectVARIABLE_NAME_MISMATCH
    1
    if (object == this)
    2
    return true;
    2
    return true;
    3
    if (!(obj instanceof XYBoxAndWhiskerRenderer))
    3
    if (!(obj instanceof XYBoxAndWhiskerRenderer))
    3
    if (!(object instanceof Task))
    Differences
    Expression1Expression2Difference
    objobjectVARIABLE_NAME_MISMATCH
    org.jfree.chart.renderer.xy.XYBoxAndWhiskerRendererorg.jfree.data.gantt.TaskSUBCLASS_TYPE_MISMATCH
    3
    if (!(object instanceof Task))
    4
    return false;
    4
    return false;
                                                        
    5
    Task that = (Task)object;
    5
    if (!super.equals(obj))
    5
    if (!super.equals(obj))
    6
    if (!ObjectUtilities.equal(this.description, that.description))
    Differences
    Expression1Expression2Difference
    super.equals(obj)ObjectUtilities.equal(this.description,that.description)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.description,that.description) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Super method call if(!super.equals(obj)) cannot be extracted from method
    6
    if (!ObjectUtilities.equal(this.description, that.description))
    6
    return false;
    7
    return false;
    7
    XYBoxAndWhiskerRenderer that = (XYBoxAndWhiskerRenderer)obj;
                                                                                                                              
    8
    if (this.boxWidth != that.getBoxWidth())
                                                                                        
    9
    return false;
    9
    return false;
    Preondition Violations
    Unmatched return false;
                                    
    10
    if (!PaintUtilities.equal(this.boxPaint, that.boxPaint))
    10
    if (!PaintUtilities.equal(this.boxPaint, that.boxPaint))
    10
    if (!ObjectUtilities.equal(this.percentComplete, that.percentComplete))
    Differences
    Expression1Expression2Difference
    boxPaintpercentCompleteVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.lang.DoubleVARIABLE_TYPE_MISMATCH
    org.jfree.chart.renderer.xy.XYBoxAndWhiskerRendererorg.jfree.data.gantt.TaskSUBCLASS_TYPE_MISMATCH
    boxPaintpercentCompleteVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.lang.DoubleVARIABLE_TYPE_MISMATCH
    org.jfree.util.PaintUtilitiesorg.jfree.util.ObjectUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable this.boxPaint does not match with type java.lang.Double of variable this.percentComplete
    • Make classes java.awt.Paint and java.lang.Double extend a common superclass
    Expression that.boxPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.percentComplete cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Paint of variable that.boxPaint does not match with type java.lang.Double of variable that.percentComplete
    • Make classes java.awt.Paint and java.lang.Double extend a common superclass
    Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    • Make classes org.jfree.util.PaintUtilities and org.jfree.util.ObjectUtilities extend a common superclass
    10
    if (!ObjectUtilities.equal(this.percentComplete, that.percentComplete))
    11
    return false;
    11
    return false;
    12
    if (!PaintUtilities.equal(this.artifactPaint, that.artifactPaint))
    12
    if (!PaintUtilities.equal(this.artifactPaint, that.artifactPaint))
    8
    if (!ObjectUtilities.equal(this.duration, that.duration))
    Differences
    Expression1Expression2Difference
    artifactPaintdurationVARIABLE_NAME_MISMATCH
    java.awt.Paintorg.jfree.data.time.TimePeriodVARIABLE_TYPE_MISMATCH
    org.jfree.chart.renderer.xy.XYBoxAndWhiskerRendererorg.jfree.data.gantt.TaskSUBCLASS_TYPE_MISMATCH
    artifactPaintdurationVARIABLE_NAME_MISMATCH
    java.awt.Paintorg.jfree.data.time.TimePeriodVARIABLE_TYPE_MISMATCH
    org.jfree.util.PaintUtilitiesorg.jfree.util.ObjectUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable this.artifactPaint does not match with type org.jfree.data.time.TimePeriod of variable this.duration
    • Make classes java.awt.Paint and org.jfree.data.time.TimePeriod extend a common superclass
    Expression that.artifactPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.duration cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Paint of variable that.artifactPaint does not match with type org.jfree.data.time.TimePeriod of variable that.duration
    • Make classes java.awt.Paint and org.jfree.data.time.TimePeriod extend a common superclass
    Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    • Make classes org.jfree.util.PaintUtilities and org.jfree.util.ObjectUtilities extend a common superclass
    8
    if (!ObjectUtilities.equal(this.duration, that.duration))
    13
    return false;
    9
    return false;
    Precondition Violations (15)
    Row Violation
    1Expression ObjectUtilities.equal(this.description,that.description) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Super method call if(!super.equals(obj)) cannot be extracted from method
    3Unmatched return false;
    4Type java.awt.Paint of variable this.boxPaint does not match with type java.lang.Double of variable this.percentComplete
    5Expression that.boxPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression that.percentComplete cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Type java.awt.Paint of variable that.boxPaint does not match with type java.lang.Double of variable that.percentComplete
    8Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    9Type java.awt.Paint of variable this.artifactPaint does not match with type org.jfree.data.time.TimePeriod of variable this.duration
    10Expression that.artifactPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression that.duration cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Type java.awt.Paint of variable that.artifactPaint does not match with type org.jfree.data.time.TimePeriod of variable that.duration
    13Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    14Not all possible execution flows end in a return statement
    15The refactoring of the clones is infeasible, because classes org.jfree.chart.renderer.xy.XYBoxAndWhiskerRenderer and org.jfree.data.gantt.Task do not have a common superclass