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;
if (obj == this) { return true; } if (!(obj instanceof MeterInterval)) { return false; } MeterInterval that = (MeterInterval) obj; if (!this.label.equals(that.label)) { return false; } if (!this.range.equals(that.range)) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) { return false; } if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYShapeAnnotation.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/MeterInterval.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
        
5
        if (!super.equals(obj)) {
6
            return false;
7
        }
8
        if (!(obj instanceof XYShapeAnnotation)) {
9
            return false;
10
        }
11
        XYShapeAnnotation that = (XYShapeAnnotation) obj;
5
if (!(obj instanceof MeterInterval)) {
6
            return false;
7
        }
8
        MeterInterval that = (MeterInterval) obj;
9
        if (!this.label.equals(that.label)) {
10
            return false;
11
        }
12
        if (!this.shape.equals(that.shape)) {
12
        if (!this.range.equals(that.range)) {
13
            return false;
13
            return false;
14
        }
14
        }
15
        if (!ObjectUtilities.equal(this.stroke, that.stroke)) {
15
        if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) {
16
            return false;
16
            return false;
17
        }
17
        }
18
        if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) {
18
        if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) {
19
            return false;
19
            return false;
20
        }
20
        }
21
        if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) {
21
        if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) {
22
            return false;
22
            return false;
23
        }
23
        }
24
        // seem to be the same
25
        return true;
24
        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)4.0
Clones locationClones are in different classes
Number of node comparisons119
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements15
    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.2
    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 MeterInterval))
    Differences
    Expression1Expression2Difference
    super.equals(obj)(obj instanceof MeterInterval)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Super method call if(!super.equals(obj)) cannot be extracted from method
    3
    if (!(obj instanceof MeterInterval))
    4
    return false;
    4
    return false;
                                                                                      
    5
    MeterInterval that = (MeterInterval)obj;
    5
    if (!(obj instanceof XYShapeAnnotation))
    5
    if (!(obj instanceof XYShapeAnnotation))
    6
    if (!this.label.equals(that.label))
    Differences
    Expression1Expression2Difference
    (obj instanceof XYShapeAnnotation)this.label.equals(that.label)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.label.equals(that.label) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (!this.label.equals(that.label))
    6
    return false;
    7
    return false;
    7
    XYShapeAnnotation that = (XYShapeAnnotation)obj;
                                                                                                      
    8
    if (!this.shape.equals(that.shape))
    8
    if (!this.shape.equals(that.shape))
    8
    if (!this.range.equals(that.range))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.plot.MeterIntervalVARIABLE_TYPE_MISMATCH
    shaperangeVARIABLE_NAME_MISMATCH
    java.awt.Shapeorg.jfree.data.RangeVARIABLE_TYPE_MISMATCH
    shaperangeVARIABLE_NAME_MISMATCH
    java.awt.Shapeorg.jfree.data.RangeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Shape of variable that.shape does not match with type org.jfree.data.Range of variable that.range
    • Make classes org.jfree.chart.annotations.XYShapeAnnotation and org.jfree.chart.plot.MeterInterval extend a common superclass
    Expression that.shape cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.range cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Shape of variable that.shape does not match with type org.jfree.data.Range of variable that.range
    • Make classes java.awt.Shape and org.jfree.data.Range extend a common superclass
    Type java.awt.Shape of variable this.shape does not match with type org.jfree.data.Range of variable this.range
    • Make classes java.awt.Shape and org.jfree.data.Range extend a common superclass
    8
    if (!this.range.equals(that.range))
    9
    return false;
    9
    return false;
    10
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    10
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    12
    if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke))
    Differences
    Expression1Expression2Difference
    strokeoutlineStrokeVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.plot.MeterIntervalVARIABLE_TYPE_MISMATCH
    strokeoutlineStrokeVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable that.stroke does not match with type java.awt.Stroke of variable that.outlineStroke
    • Make classes org.jfree.chart.annotations.XYShapeAnnotation and org.jfree.chart.plot.MeterInterval extend a common superclass
    Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.outlineStroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke))
    11
    return false;
    13
    return false;
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    10
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.plot.MeterIntervalVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable that.outlinePaint does not match with type java.awt.Paint of variable that.outlinePaint
    • Make classes org.jfree.chart.annotations.XYShapeAnnotation and org.jfree.chart.plot.MeterInterval extend a common superclass
    10
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    13
    return false;
    11
    return false;
    14
    if (!PaintUtilities.equal(this.fillPaint, that.fillPaint))
    14
    if (!PaintUtilities.equal(this.fillPaint, that.fillPaint))
    14
    if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint))
    Differences
    Expression1Expression2Difference
    fillPaintbackgroundPaintVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.plot.MeterIntervalVARIABLE_TYPE_MISMATCH
    fillPaintbackgroundPaintVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable that.fillPaint does not match with type java.awt.Paint of variable that.backgroundPaint
    • Make classes org.jfree.chart.annotations.XYShapeAnnotation and org.jfree.chart.plot.MeterInterval extend a common superclass
    Expression that.fillPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.backgroundPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14
    if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint))
    15
    return false;
    15
    return false;
    16
    return true;
    16
    return true;
    Precondition Violations (15)
    Row Violation
    1Super method call if(!super.equals(obj)) cannot be extracted from method
    2Expression this.label.equals(that.label) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type java.awt.Shape of variable that.shape does not match with type org.jfree.data.Range of variable that.range
    4Expression that.shape cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.range cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type java.awt.Shape of variable that.shape does not match with type org.jfree.data.Range of variable that.range
    7Type java.awt.Shape of variable this.shape does not match with type org.jfree.data.Range of variable this.range
    8Type java.awt.Stroke of variable that.stroke does not match with type java.awt.Stroke of variable that.outlineStroke
    9Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression that.outlineStroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Type java.awt.Paint of variable that.outlinePaint does not match with type java.awt.Paint of variable that.outlinePaint
    12Type java.awt.Paint of variable that.fillPaint does not match with type java.awt.Paint of variable that.backgroundPaint
    13Expression that.fillPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression that.backgroundPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYShapeAnnotation and org.jfree.chart.plot.MeterInterval do not have a common superclass