if (obj == this) { return true; } if (!(obj instanceof SymbolAxis)) { return false; } SymbolAxis that = (SymbolAxis) obj; if (!this.symbols.equals(that.symbols)) { return false; } if (this.gridBandsVisible != that.gridBandsVisible) { return false; } if (!PaintUtilities.equal(this.gridBandPaint, that.gridBandPaint)) { return false; } if (!PaintUtilities.equal(this.gridBandAlternatePaint, that.gridBandAlternatePaint)) { 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/axis/SymbolAxis.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 SymbolAxis)) {
4
        if (!(object instanceof Task)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        SymbolAxis that = (SymbolAxis) obj;
7
        Task that = (Task) object;
8
        if (!this.symbols.equals(that.symbols)) {
8
        if (!ObjectUtilities.equal(this.description, that.description)) {
9
            return false;
9
            return false;
10
        }
10
        }
11
        if (this.gridBandsVisible != that.gridBandsVisible) {
11
        if (!ObjectUtilities.equal(this.duration, that.duration)) {
12
            return false;
12
            return false;
13
        }
13
        }
14
        if (!PaintUtilities.equal(this.gridBandPaint, that.gridBandPaint
14
        if (!ObjectUtilities.equal(this.percentComplete, 
15
)) {
15
                that.percentComplete)) {
16
            return false;
16
            return false;
17
        }
17
        }
18
        if (!PaintUtilities.equal(this.gridBandAlternatePaint, 
18
        if (!ObjectUtilities.equal(this.
19
                that.gridBandAlternatePaint)) {
19
subtasks, that.subtasks)) {
20
            return false;
20
            return false;
21
        }
21
        }
22
        return super.equals(obj);
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)3.5
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)5.8
    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 SymbolAxis))
    3
    if (!(obj instanceof SymbolAxis))
    3
    if (!(object instanceof Task))
    Differences
    Expression1Expression2Difference
    objobjectVARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.SymbolAxisorg.jfree.data.gantt.TaskSUBCLASS_TYPE_MISMATCH
    3
    if (!(object instanceof Task))
    4
    return false;
    4
    return false;
    5
    SymbolAxis that = (SymbolAxis)obj;
    5
    SymbolAxis that = (SymbolAxis)obj;
    5
    Task that = (Task)object;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.SymbolAxisorg.jfree.data.gantt.TaskSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.SymbolAxisorg.jfree.data.gantt.TaskSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.SymbolAxisorg.jfree.data.gantt.TaskSUBCLASS_TYPE_MISMATCH
    objobjectVARIABLE_NAME_MISMATCH
    5
    Task that = (Task)object;
    6
    if (!this.symbols.equals(that.symbols))
    6
    if (!this.symbols.equals(that.symbols))
    6
    if (!ObjectUtilities.equal(this.description, that.description))
    Differences
    Expression1Expression2Difference
    this.symbols.equals(that.symbols)ObjectUtilities.equal(this.description,that.description)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.symbols.equals(that.symbols) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ObjectUtilities.equal(this.description,that.description) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (!ObjectUtilities.equal(this.description, that.description))
    7
    return false;
    7
    return false;
    8
    if (this.gridBandsVisible != that.gridBandsVisible)
    8
    if (this.gridBandsVisible != that.gridBandsVisible)
    Preondition Violations
    Unmatched statement if(this.gridBandsVisible != that.gridBandsVisible) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                              
    9
    return false;
    9
    return false;
    Preondition Violations
    Unmatched return false;
                                    
    10
    if (!PaintUtilities.equal(this.gridBandPaint, that.gridBandPaint))
    10
    if (!PaintUtilities.equal(this.gridBandPaint, that.gridBandPaint))
    10
    if (!ObjectUtilities.equal(this.percentComplete, that.percentComplete))
    Differences
    Expression1Expression2Difference
    gridBandPaintpercentCompleteVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.lang.DoubleVARIABLE_TYPE_MISMATCH
    org.jfree.chart.axis.SymbolAxisorg.jfree.data.gantt.TaskSUBCLASS_TYPE_MISMATCH
    gridBandPaintpercentCompleteVARIABLE_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.gridBandPaint 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.gridBandPaint 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.gridBandPaint 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.gridBandAlternatePaint, that.gridBandAlternatePaint))
    12
    if (!PaintUtilities.equal(this.gridBandAlternatePaint, that.gridBandAlternatePaint))
    8
    if (!ObjectUtilities.equal(this.duration, that.duration))
    Differences
    Expression1Expression2Difference
    gridBandAlternatePaintdurationVARIABLE_NAME_MISMATCH
    java.awt.Paintorg.jfree.data.time.TimePeriodVARIABLE_TYPE_MISMATCH
    org.jfree.chart.axis.SymbolAxisorg.jfree.data.gantt.TaskSUBCLASS_TYPE_MISMATCH
    gridBandAlternatePaintdurationVARIABLE_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.gridBandAlternatePaint 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.gridBandAlternatePaint 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.gridBandAlternatePaint 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 (17)
    Row Violation
    1Expression this.symbols.equals(that.symbols) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression ObjectUtilities.equal(this.description,that.description) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement if(this.gridBandsVisible != that.gridBandsVisible) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return false;
    5Type java.awt.Paint of variable this.gridBandPaint does not match with type java.lang.Double of variable this.percentComplete
    6Expression that.gridBandPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression that.percentComplete cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Type java.awt.Paint of variable that.gridBandPaint does not match with type java.lang.Double of variable that.percentComplete
    9Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    10Type java.awt.Paint of variable this.gridBandAlternatePaint does not match with type org.jfree.data.time.TimePeriod of variable this.duration
    11Expression that.gridBandAlternatePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression that.duration cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Type java.awt.Paint of variable that.gridBandAlternatePaint does not match with type org.jfree.data.time.TimePeriod of variable that.duration
    14Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    15Clone fragment #1 returns variable that with type org.jfree.chart.axis.SymbolAxis , 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.axis.SymbolAxis and org.jfree.data.gantt.Task do not have a common superclass