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 GanttRenderer)) { return false; } GanttRenderer that = (GanttRenderer) obj; if (!PaintUtilities.equal(this.completePaint, that.completePaint)) { return false; } if (!PaintUtilities.equal(this.incompletePaint, that.incompletePaint)) { return false; } if (this.startPercent != that.startPercent) { return false; } if (this.endPercent != that.endPercent) { 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/renderer/category/GanttRenderer.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 GanttRenderer)) {
9
            return false;
5
            return false;
10
        }
6
        }
11
        XYImageAnnotation that = (XYImageAnnotation) obj;
7
        
12
        if (this.x != that.x) {
13
            return false;
14
        }
15
        if (this.y != that.y
8
GanttRenderer that = (GanttRenderer) obj;
9
        if (!PaintUtilities.equal(this.completePaint, that.completePaint)) {
10
            return false;
11
        }
16
) {
12
        if (!PaintUtilities.equal(this.incompletePaint, that.incompletePaint)) {
17
            return false;
13
            return false;
18
        }
14
        }
19
        if (!ObjectUtilities.equal(this.image, that.image)) {
15
        if (this.startPercent != that.startPercent) {
20
            return false;
16
            return false;
21
        }
17
        }
22
        if (!this.anchor.equals(that.anchor)) {
18
        if (this.endPercent != that.endPercent) {
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.8
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.9
    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 GanttRenderer))
    Differences
    Expression1Expression2Difference
    super.equals(obj)(obj instanceof GanttRenderer)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Super method call if(!super.equals(obj)) cannot be extracted from method
    3
    if (!(obj instanceof GanttRenderer))
    4
    return false;
    4
    return false;
                                                                                      
    5
    GanttRenderer that = (GanttRenderer)obj;
    5
    if (!(obj instanceof XYImageAnnotation))
    5
    if (!(obj instanceof XYImageAnnotation))
    6
    if (!PaintUtilities.equal(this.completePaint, that.completePaint))
    Differences
    Expression1Expression2Difference
    (obj instanceof XYImageAnnotation)PaintUtilities.equal(this.completePaint,that.completePaint)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression PaintUtilities.equal(this.completePaint,that.completePaint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (!PaintUtilities.equal(this.completePaint, that.completePaint))
    6
    return false;
    7
    return false;
    7
    XYImageAnnotation that = (XYImageAnnotation)obj;
                                                                                                      
    8
    if (this.x != that.x)
    8
    if (this.x != that.x)
    10
    if (this.startPercent != that.startPercent)
    Differences
    Expression1Expression2Difference
    xstartPercentVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.GanttRendererSUBCLASS_TYPE_MISMATCH
    xstartPercentVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.startPercent cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (this.startPercent != that.startPercent)
    9
    return false;
    11
    return false;
    10
    if (this.y != that.y)
    10
    if (this.y != that.y)
    12
    if (this.endPercent != that.endPercent)
    Differences
    Expression1Expression2Difference
    yendPercentVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.GanttRendererSUBCLASS_TYPE_MISMATCH
    yendPercentVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.endPercent cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    if (this.endPercent != that.endPercent)
    11
    return false;
    13
    return false;
    12
    if (!ObjectUtilities.equal(this.image, that.image))
    12
    if (!ObjectUtilities.equal(this.image, that.image))
    8
    if (!PaintUtilities.equal(this.incompletePaint, that.incompletePaint))
    Differences
    Expression1Expression2Difference
    imageincompletePaintVARIABLE_NAME_MISMATCH
    java.awt.Imagejava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.renderer.category.GanttRendererSUBCLASS_TYPE_MISMATCH
    imageincompletePaintVARIABLE_NAME_MISMATCH
    java.awt.Imagejava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.util.ObjectUtilitiesorg.jfree.util.PaintUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Image of variable this.image does not match with type java.awt.Paint of variable this.incompletePaint
    • Make classes java.awt.Image and java.awt.Paint extend a common superclass
    Expression that.image cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.incompletePaint 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.awt.Paint of variable that.incompletePaint
    • Make classes java.awt.Image and java.awt.Paint extend a common superclass
    Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.PaintUtilities
    • Make classes org.jfree.util.ObjectUtilities and org.jfree.util.PaintUtilities extend a common superclass
    8
    if (!PaintUtilities.equal(this.incompletePaint, that.incompletePaint))
    13
    return false;
    9
    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 (14)
    Row Violation
    1Super method call if(!super.equals(obj)) cannot be extracted from method
    2Expression PaintUtilities.equal(this.completePaint,that.completePaint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression that.startPercent cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression that.endPercent cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Type java.awt.Image of variable this.image does not match with type java.awt.Paint of variable this.incompletePaint
    8Expression that.image cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression that.incompletePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Type java.awt.Image of variable that.image does not match with type java.awt.Paint of variable that.incompletePaint
    11Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.PaintUtilities
    12Super method call return super.equals(obj); cannot be extracted from method
    13Not all possible execution flows end in a return statement
    14The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYImageAnnotation and org.jfree.chart.renderer.category.GanttRenderer do not have a common superclass