if (obj == this) { return true; } // now try to reject equality... if (!super.equals(obj)) { return false; } if (!(obj instanceof XYImageAnnotation)) { return false; } XYImageAnnotation that = (XYImageAnnotation) obj; if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (!ObjectUtilities.equal(this.image, that.image)) { return false; } if (!this.anchor.equals(that.anchor)) { return false; } // seems to be the same... return true;
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/annotations/XYImageAnnotation.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: 16 Number of AST nodes: 14
1
if (obj == this) {
1
if (obj == this) {
2
            return true;
2
            return true;
3
        }
3
        }
4
        // now try to reject equality...
5
        if (!super.equals(obj)) {
6
            return false;
7
        }
8
        if (!(obj instanceof XYImageAnnotation)) {
4
        if (!(obj instanceof PieSectionEntity)) {
9
            return false;
5
            return false;
10
        }
6
        }
11
        XYImageAnnotation that = (XYImageAnnotation) obj;
7
        
12
        if (this.x != that.x
8
PieSectionEntity that = (PieSectionEntity) obj;
13
) {
9
        if (!ObjectUtilities.equal(this.dataset, that.dataset)) {
14
            return false;
10
            return false;
15
        }
11
        }
16
        if (this.y != that.y) {
12
        if (this.pieIndex != that.pieIndex) {
17
            return false;
13
            return false;
18
        }
14
        }
19
        if (!ObjectUtilities.equal(this.image, that.image)) {
15
        if (this.sectionIndex != that.sectionIndex) {
20
            return false;
16
            return false;
21
        }
17
        }
22
        if (!this.anchor.equals(that.anchor)) {
18
        if (!ObjectUtilities.equal(this.sectionKey, that.sectionKey)) {
23
            return false;
19
            return false;
24
        }
20
        }
25
        // seems to be the same...
21
        
26
        return true;
22
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 comparisons76
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)4.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj == this)
    1
    if (obj == this)
    2
    return true;
    2
    return true;
    3
    if (!super.equals(obj))
    3
    if (!super.equals(obj))
    3
    if (!(obj instanceof PieSectionEntity))
    Differences
    Expression1Expression2Difference
    super.equals(obj)(obj instanceof PieSectionEntity)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Super method call if(!super.equals(obj)) cannot be extracted from method
    3
    if (!(obj instanceof PieSectionEntity))
    4
    return false;
    4
    return false;
                                                                                                  
    5
    PieSectionEntity that = (PieSectionEntity)obj;
    5
    if (!(obj instanceof XYImageAnnotation))
    5
    if (!(obj instanceof XYImageAnnotation))
    6
    if (!ObjectUtilities.equal(this.dataset, that.dataset))
    Differences
    Expression1Expression2Difference
    (obj instanceof XYImageAnnotation)ObjectUtilities.equal(this.dataset,that.dataset)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    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))
    6
    return false;
    7
    return false;
    7
    XYImageAnnotation that = (XYImageAnnotation)obj;
                                                                                                      
    8
    if (this.x != that.x)
    8
    if (this.x != that.x)
    8
    if (this.pieIndex != that.pieIndex)
    Differences
    Expression1Expression2Difference
    xpieIndexVARIABLE_NAME_MISMATCH
    doubleintVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.entity.PieSectionEntitySUBCLASS_TYPE_MISMATCH
    xpieIndexVARIABLE_NAME_MISMATCH
    doubleintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double of variable this.x does not match with type int of variable this.pieIndex
    Expression that.x 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 double of variable that.x 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.y != that.y)
    10
    if (this.y != that.y)
    10
    if (this.sectionIndex != that.sectionIndex)
    Differences
    Expression1Expression2Difference
    ysectionIndexVARIABLE_NAME_MISMATCH
    doubleintVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.entity.PieSectionEntitySUBCLASS_TYPE_MISMATCH
    ysectionIndexVARIABLE_NAME_MISMATCH
    doubleintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double of variable this.y does not match with type int of variable this.sectionIndex
    Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.sectionIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type double of variable that.y does not match with type int of variable that.sectionIndex
    10
    if (this.sectionIndex != that.sectionIndex)
    11
    return false;
    11
    return false;
    12
    if (!ObjectUtilities.equal(this.image, that.image))
    12
    if (!ObjectUtilities.equal(this.image, that.image))
    12
    if (!ObjectUtilities.equal(this.sectionKey, that.sectionKey))
    Differences
    Expression1Expression2Difference
    imagesectionKeyVARIABLE_NAME_MISMATCH
    java.awt.Imagejava.lang.ComparableVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.entity.PieSectionEntitySUBCLASS_TYPE_MISMATCH
    imagesectionKeyVARIABLE_NAME_MISMATCH
    java.awt.Imagejava.lang.ComparableVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Image of variable this.image does not match with type java.lang.Comparable of variable this.sectionKey
    • Make classes java.awt.Image and java.lang.Comparable extend a common superclass
    Expression that.image 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.Image of variable that.image does not match with type java.lang.Comparable of variable that.sectionKey
    • Make classes java.awt.Image and java.lang.Comparable extend a common superclass
    12
    if (!ObjectUtilities.equal(this.sectionKey, that.sectionKey))
    13
    return false;
    13
    return false;
    16
    return true;
    16
    return true;
    14
    return super.equals(obj);
    Differences
    Expression1Expression2Difference
    truesuper.equals(obj)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Super method call return super.equals(obj); cannot be extracted from method
    14
    return super.equals(obj);
    Precondition Violations (17)
    Row Violation
    1Super method call if(!super.equals(obj)) cannot be extracted from method
    2Expression ObjectUtilities.equal(this.dataset,that.dataset) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type double of variable this.x does not match with type int of variable this.pieIndex
    4Expression that.x 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 double of variable that.x does not match with type int of variable that.pieIndex
    7Type double of variable this.y does not match with type int of variable this.sectionIndex
    8Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression that.sectionIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Type double of variable that.y does not match with type int of variable that.sectionIndex
    11Type java.awt.Image of variable this.image does not match with type java.lang.Comparable of variable this.sectionKey
    12Expression that.image cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression that.sectionKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Type java.awt.Image of variable that.image does not match with type java.lang.Comparable of variable that.sectionKey
    15Super method call return super.equals(obj); cannot be extracted from method
    16Not all possible execution flows end in a return statement
    17The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYImageAnnotation and org.jfree.chart.entity.PieSectionEntity do not have a common superclass