if (obj == this) { return true; } if (!(obj instanceof StandardDialFrame)) { return false; } StandardDialFrame that = (StandardDialFrame) obj; if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) { return false; } if (!PaintUtilities.equal(this.foregroundPaint, that.foregroundPaint)) { return false; } if (this.radius != that.radius) { return false; } if (!this.stroke.equals(that.stroke)) { return false; } return super.equals(obj);
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/plot/dial/StandardDialFrame.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: 14 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 StandardDialFrame)) {
4
        if (!(object instanceof Task)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        StandardDialFrame that = (StandardDialFrame) obj;
7
        Task that = (Task) object;
8
        if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) {
8
        if (!ObjectUtilities.equal(this.description, that.description)) {
9
            return false;
9
            return false;
10
        }
10
        }
11
        if (!PaintUtilities.equal(this.foregroundPaint, that.foregroundPaint)) {
11
        if (!ObjectUtilities.equal(this.duration, that.duration)) {
12
            return false;
12
            return false;
13
        }
13
        }
14
        if (this.radius != that.radius
14
        if (!ObjectUtilities.equal(this.percentComplete, 
15
) {
15
                that.percentComplete)) {
16
            return false;
16
            return false;
17
        }
17
        }
18
        if (!this.stroke.equals(that.stroke)) {
18
        if (!ObjectUtilities.equal(this.subtasks, that.subtasks)) {
19
            return false;
19
            return false;
20
        }
20
        }
21
        return super.equals(obj);
21
        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)3.4
Clones locationClones are in different classes
Number of node comparisons70
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.3
    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 StandardDialFrame))
    3
    if (!(obj instanceof StandardDialFrame))
    3
    if (!(object instanceof Task))
    Differences
    Expression1Expression2Difference
    objobjectVARIABLE_NAME_MISMATCH
    org.jfree.chart.plot.dial.StandardDialFrameorg.jfree.data.gantt.TaskSUBCLASS_TYPE_MISMATCH
    3
    if (!(object instanceof Task))
    4
    return false;
    4
    return false;
    5
    StandardDialFrame that = (StandardDialFrame)obj;
    5
    StandardDialFrame that = (StandardDialFrame)obj;
    5
    Task that = (Task)object;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.dial.StandardDialFrameorg.jfree.data.gantt.TaskSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.dial.StandardDialFrameorg.jfree.data.gantt.TaskSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.dial.StandardDialFrameorg.jfree.data.gantt.TaskSUBCLASS_TYPE_MISMATCH
    objobjectVARIABLE_NAME_MISMATCH
    5
    Task that = (Task)object;
    6
    if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint))
    6
    if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint))
    6
    if (!ObjectUtilities.equal(this.description, that.description))
    Differences
    Expression1Expression2Difference
    backgroundPaintdescriptionVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.lang.StringVARIABLE_TYPE_MISMATCH
    org.jfree.chart.plot.dial.StandardDialFrameorg.jfree.data.gantt.TaskSUBCLASS_TYPE_MISMATCH
    backgroundPaintdescriptionVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.lang.StringVARIABLE_TYPE_MISMATCH
    org.jfree.util.PaintUtilitiesorg.jfree.util.ObjectUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable this.backgroundPaint does not match with type java.lang.String of variable this.description
    • Make classes java.awt.Paint and java.lang.String extend a common superclass
    Expression that.backgroundPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.description cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Paint of variable that.backgroundPaint does not match with type java.lang.String of variable that.description
    • Make classes java.awt.Paint and java.lang.String 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
    6
    if (!ObjectUtilities.equal(this.description, that.description))
    7
    return false;
    7
    return false;
    8
    if (!PaintUtilities.equal(this.foregroundPaint, that.foregroundPaint))
    8
    if (!PaintUtilities.equal(this.foregroundPaint, that.foregroundPaint))
    8
    if (!ObjectUtilities.equal(this.duration, that.duration))
    Differences
    Expression1Expression2Difference
    foregroundPaintdurationVARIABLE_NAME_MISMATCH
    java.awt.Paintorg.jfree.data.time.TimePeriodVARIABLE_TYPE_MISMATCH
    org.jfree.chart.plot.dial.StandardDialFrameorg.jfree.data.gantt.TaskSUBCLASS_TYPE_MISMATCH
    foregroundPaintdurationVARIABLE_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.foregroundPaint 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.foregroundPaint 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.foregroundPaint 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))
    9
    return false;
    9
    return false;
    10
    if (this.radius != that.radius)
    10
    if (this.radius != that.radius)
    Preondition Violations
    Unmatched statement if(this.radius != that.radius) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                        
    11
    return false;
    11
    return false;
    Preondition Violations
    Unmatched return false;
                                      
    12
    if (!this.stroke.equals(that.stroke))
    12
    if (!this.stroke.equals(that.stroke))
    10
    if (!ObjectUtilities.equal(this.percentComplete, that.percentComplete))
    Differences
    Expression1Expression2Difference
    this.stroke.equals(that.stroke)ObjectUtilities.equal(this.percentComplete,that.percentComplete)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.stroke.equals(that.stroke) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ObjectUtilities.equal(this.percentComplete,that.percentComplete) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (!ObjectUtilities.equal(this.percentComplete, that.percentComplete))
    13
    return false;
    11
    return false;
    Precondition Violations (17)
    Row Violation
    1Type java.awt.Paint of variable this.backgroundPaint does not match with type java.lang.String of variable this.description
    2Expression that.backgroundPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression that.description cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Type java.awt.Paint of variable that.backgroundPaint does not match with type java.lang.String of variable that.description
    5Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    6Type java.awt.Paint of variable this.foregroundPaint does not match with type org.jfree.data.time.TimePeriod of variable this.duration
    7Expression that.foregroundPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression that.duration cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type java.awt.Paint of variable that.foregroundPaint does not match with type org.jfree.data.time.TimePeriod of variable that.duration
    10Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    11Unmatched statement if(this.radius != that.radius) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12Unmatched return false;
    13Expression this.stroke.equals(that.stroke) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression ObjectUtilities.equal(this.percentComplete,that.percentComplete) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Clone fragment #1 returns variable that with type org.jfree.chart.plot.dial.StandardDialFrame , while Clone fragment #2 returns variable that with type org.jfree.data.gantt.Task
    16Not all possible execution flows end in a return statement
    17The refactoring of the clones is infeasible, because classes org.jfree.chart.plot.dial.StandardDialFrame and org.jfree.data.gantt.Task do not have a common superclass