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 (obj == this) { return true; } if (!(obj instanceof PieSectionEntity)) { return false; } PieSectionEntity that = (PieSectionEntity) obj; if (!ObjectUtilities.equal(this.dataset, that.dataset)) { return false; } if (this.pieIndex != that.pieIndex) { return false; } if (this.sectionIndex != that.sectionIndex) { return false; } if (!ObjectUtilities.equal(this.sectionKey, that.sectionKey)) { return false; } return super.equals(obj);
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/chart/entity/PieSectionEntity.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 (obj == this) {
2
            return true;
2
            return true;
3
        }
3
        }
4
        if (!(obj instanceof SymbolAxis)) {
4
        if (!(obj instanceof PieSectionEntity)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        SymbolAxis that = (SymbolAxis) obj;
7
        PieSectionEntity that = (PieSectionEntity) obj;
8
        if (!this.symbols.equals(that.symbols)) {
8
        if (!ObjectUtilities.equal(this.dataset, that.dataset)) {
9
            return false;
9
            return false;
10
        }
10
        }
11
        if (this.gridBandsVisible != that.gridBandsVisible) {
11
        if (this.pieIndex != that.pieIndex) {
12
            return false;
12
            return false;
13
        }
13
        }
14
        if (!PaintUtilities.equal(this.gridBandPaint, that.gridBandPaint)) {
14
        if (this.sectionIndex != that.sectionIndex) {
15
            return false;
15
            return false;
16
        }
16
        }
17
        if (!PaintUtilities.equal(this.gridBandAlternatePaint, 
17
        if (!ObjectUtilities.equal(this.
18
                that.gridBandAlternatePaint)) {
18
sectionKey, that.sectionKey)) {
19
            return false;
19
            return false;
20
        }
20
        }
21
        return super.equals(obj);
21
        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)3.0
Clones locationClones are in different classes
Number of node comparisons64
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)6.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 SymbolAxis))
    3
    if (!(obj instanceof SymbolAxis))
    3
    if (!(obj instanceof PieSectionEntity))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.SymbolAxisorg.jfree.chart.entity.PieSectionEntitySUBCLASS_TYPE_MISMATCH
    3
    if (!(obj instanceof PieSectionEntity))
    4
    return false;
    4
    return false;
    5
    SymbolAxis that = (SymbolAxis)obj;
    5
    SymbolAxis that = (SymbolAxis)obj;
    5
    PieSectionEntity that = (PieSectionEntity)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.SymbolAxisorg.jfree.chart.entity.PieSectionEntitySUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.SymbolAxisorg.jfree.chart.entity.PieSectionEntitySUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.SymbolAxisorg.jfree.chart.entity.PieSectionEntitySUBCLASS_TYPE_MISMATCH
    5
    PieSectionEntity that = (PieSectionEntity)obj;
    6
    if (!this.symbols.equals(that.symbols))
    6
    if (!this.symbols.equals(that.symbols))
    6
    if (!ObjectUtilities.equal(this.dataset, that.dataset))
    Differences
    Expression1Expression2Difference
    this.symbols.equals(that.symbols)ObjectUtilities.equal(this.dataset,that.dataset)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.dataset,that.dataset) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (!ObjectUtilities.equal(this.dataset, that.dataset))
    7
    return false;
    7
    return false;
    8
    if (this.gridBandsVisible != that.gridBandsVisible)
    8
    if (this.gridBandsVisible != that.gridBandsVisible)
    8
    if (this.pieIndex != that.pieIndex)
    Differences
    Expression1Expression2Difference
    gridBandsVisiblepieIndexVARIABLE_NAME_MISMATCH
    booleanintVARIABLE_TYPE_MISMATCH
    org.jfree.chart.axis.SymbolAxisorg.jfree.chart.entity.PieSectionEntitySUBCLASS_TYPE_MISMATCH
    gridBandsVisiblepieIndexVARIABLE_NAME_MISMATCH
    booleanintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type boolean of variable this.gridBandsVisible does not match with type int of variable this.pieIndex
    Expression that.gridBandsVisible cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.pieIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type boolean of variable that.gridBandsVisible does not match with type int of variable that.pieIndex
    8
    if (this.pieIndex != that.pieIndex)
    9
    return false;
    9
    return false;
                                                                                                
    10
    if (this.sectionIndex != that.sectionIndex)
    Preondition Violations
    Unmatched statement if(this.sectionIndex != that.sectionIndex) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    if (this.sectionIndex != that.sectionIndex)
                                      
    11
    return false;
    Preondition Violations
    Unmatched return false;
    11
    return false;
    10
    if (!PaintUtilities.equal(this.gridBandPaint, that.gridBandPaint))
    10
    if (!PaintUtilities.equal(this.gridBandPaint, that.gridBandPaint))
    12
    if (!ObjectUtilities.equal(this.sectionKey, that.sectionKey))
    Differences
    Expression1Expression2Difference
    gridBandPaintsectionKeyVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.lang.ComparableVARIABLE_TYPE_MISMATCH
    org.jfree.chart.axis.SymbolAxisorg.jfree.chart.entity.PieSectionEntitySUBCLASS_TYPE_MISMATCH
    gridBandPaintsectionKeyVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.lang.ComparableVARIABLE_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.Comparable of variable this.sectionKey
    • Make classes java.awt.Paint and java.lang.Comparable extend a common superclass
    Expression that.gridBandPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.sectionKey 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.Comparable of variable that.sectionKey
    • Make classes java.awt.Paint and java.lang.Comparable 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
    12
    if (!ObjectUtilities.equal(this.sectionKey, that.sectionKey))
    11
    return false;
    13
    return false;
    Precondition Violations (16)
    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.dataset,that.dataset) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type boolean of variable this.gridBandsVisible does not match with type int of variable this.pieIndex
    4Expression that.gridBandsVisible cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.pieIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type boolean of variable that.gridBandsVisible does not match with type int of variable that.pieIndex
    7Unmatched statement if(this.sectionIndex != that.sectionIndex) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched return false;
    9Type java.awt.Paint of variable this.gridBandPaint does not match with type java.lang.Comparable of variable this.sectionKey
    10Expression that.gridBandPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression that.sectionKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Type java.awt.Paint of variable that.gridBandPaint does not match with type java.lang.Comparable of variable that.sectionKey
    13Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    14Clone fragment #1 returns variable that with type org.jfree.chart.axis.SymbolAxis , while Clone fragment #2 returns variable that with type org.jfree.chart.entity.PieSectionEntity
    15Not all possible execution flows end in a return statement
    16The refactoring of the clones is infeasible, because classes org.jfree.chart.axis.SymbolAxis and org.jfree.chart.entity.PieSectionEntity do not have a common superclass