if (obj == this) { return true; } // now try to reject equality if (!super.equals(obj)) { return false; } if (!(obj instanceof XYPolygonAnnotation)) { return false; } XYPolygonAnnotation that = (XYPolygonAnnotation) obj; if (!Arrays.equals(this.polygon, that.polygon)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } // seem to be the same return true;
if (obj == this) { return true; } // now try to reject equality if (!super.equals(obj)) { return false; } if (!(obj instanceof XYShapeAnnotation)) { return false; } XYShapeAnnotation that = (XYShapeAnnotation) obj; if (!this.shape.equals(that.shape)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } // seem to be the same return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYPolygonAnnotation.java File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYShapeAnnotation.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 16 Number of AST nodes: 16
1
if (obj == this) {
1
if (obj == this) {
2
            return true;
2
            return true;
3
        }
3
        }
4
        // now try to reject equality
4
        // now try to reject equality
5
        if (!super.equals(obj)) {
5
        if (!super.equals(obj)) {
6
            return false;
6
            return false;
7
        }
7
        }
8
        if (!(obj instanceof XYPolygonAnnotation)) {
8
        if (!(obj instanceof XYShapeAnnotation)) {
9
            return false;
9
            return false;
10
        }
10
        }
11
        XYPolygonAnnotation that = (XYPolygonAnnotation) obj;
11
        XYShapeAnnotation that = (XYShapeAnnotation) obj;
12
        if (!Arrays.equals(this.polygon, that.polygon)) {
12
        if (!this.shape.equals(that.shape)) {
13
            return false;   
13
            return false;
14
        }
14
        }
15
        if (!ObjectUtilities.equal(this.stroke, that.stroke)) {
15
        if (!ObjectUtilities.equal(this.stroke, that.stroke)) {
16
            return false;
16
            return false;
17
        }
17
        }
18
        if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) {
18
        if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) {
19
            return false;
19
            return false;
20
        }
20
        }
21
        if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) {
21
        if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) {
22
            return false;
22
            return false;
23
        }
23
        }
24
        // seem to be the same
24
        // seem to be the same
25
        return true;
25
        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)5.4
Clones locationClones are in different classes having the same super class
Number of node comparisons110
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements16
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)5.5
    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 (!super.equals(obj))
    Preondition Violations
    Super method call if(!super.equals(obj)) cannot be extracted from method
    Super method call if(!super.equals(obj)) cannot be extracted from method
    3
    if (!super.equals(obj))
    4
    return false;
    4
    return false;
    5
    if (!(obj instanceof XYPolygonAnnotation))
    5
    if (!(obj instanceof XYPolygonAnnotation))
    5
    if (!(obj instanceof XYShapeAnnotation))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.annotations.XYShapeAnnotationSUBCLASS_TYPE_MISMATCH
    5
    if (!(obj instanceof XYShapeAnnotation))
    6
    return false;
    6
    return false;
    7
    XYPolygonAnnotation that = (XYPolygonAnnotation)obj;
    7
    XYPolygonAnnotation that = (XYPolygonAnnotation)obj;
    7
    XYShapeAnnotation that = (XYShapeAnnotation)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.annotations.XYShapeAnnotationSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.annotations.XYShapeAnnotationSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.annotations.XYShapeAnnotationSUBCLASS_TYPE_MISMATCH
    7
    XYShapeAnnotation that = (XYShapeAnnotation)obj;
    8
    if (!Arrays.equals(this.polygon, that.polygon))
    8
    if (!Arrays.equals(this.polygon, that.polygon))
    8
    if (!this.shape.equals(that.shape))
    Differences
    Expression1Expression2Difference
    Arrays.equals(this.polygon,that.polygon)this.shape.equals(that.shape)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression Arrays.equals(this.polygon,that.polygon) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.shape.equals(that.shape) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (!this.shape.equals(that.shape))
    9
    return false;
    9
    return false;
    10
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    10
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    10
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.annotations.XYShapeAnnotationSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression that.stroke cannot be unified with expression that.stroke , because common superclass org.jfree.chart.annotations.AbstractXYAnnotation does not declare member(s) private transient java.awt.Stroke stroke
    10
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    11
    return false;
    11
    return false;
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.annotations.XYShapeAnnotationSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression that.outlinePaint cannot be unified with expression that.outlinePaint , because common superclass org.jfree.chart.annotations.AbstractXYAnnotation does not declare member(s) private transient java.awt.Paint outlinePaint
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    13
    return false;
    13
    return false;
    14
    if (!PaintUtilities.equal(this.fillPaint, that.fillPaint))
    14
    if (!PaintUtilities.equal(this.fillPaint, that.fillPaint))
    14
    if (!PaintUtilities.equal(this.fillPaint, that.fillPaint))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.annotations.XYShapeAnnotationSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression that.fillPaint cannot be unified with expression that.fillPaint , because common superclass org.jfree.chart.annotations.AbstractXYAnnotation does not declare member(s) private transient java.awt.Paint fillPaint
    14
    if (!PaintUtilities.equal(this.fillPaint, that.fillPaint))
    15
    return false;
    15
    return false;
    16
    return true;
    16
    return true;
    Precondition Violations (7)
    Row Violation
    1Super method call if(!super.equals(obj)) cannot be extracted from method
    2Super method call if(!super.equals(obj)) cannot be extracted from method
    3Expression Arrays.equals(this.polygon,that.polygon) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression this.shape.equals(that.shape) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.stroke cannot be unified with expression that.stroke , because common superclass org.jfree.chart.annotations.AbstractXYAnnotation does not declare member(s) private transient java.awt.Stroke stroke
    6Expression that.outlinePaint cannot be unified with expression that.outlinePaint , because common superclass org.jfree.chart.annotations.AbstractXYAnnotation does not declare member(s) private transient java.awt.Paint outlinePaint
    7Expression that.fillPaint cannot be unified with expression that.fillPaint , because common superclass org.jfree.chart.annotations.AbstractXYAnnotation does not declare member(s) private transient java.awt.Paint fillPaint