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 DateAxis)) { return false; } DateAxis that = (DateAxis) obj; if (!ObjectUtilities.equal(this.tickUnit, that.tickUnit)) { return false; } if (!ObjectUtilities.equal(this.dateFormatOverride, that.dateFormatOverride)) { return false; } if (!ObjectUtilities.equal(this.tickMarkPosition, that.tickMarkPosition)) { return false; } if (!ObjectUtilities.equal(this.timeline, that.timeline)) { return false; } if (!super.equals(obj)) { 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/axis/DateAxis.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
5
        if (!super.equals(obj)) {
6
            return false;
7
        }
8
        if (!(obj instanceof XYShapeAnnotation)) {
4
        if (!(obj instanceof DateAxis)) {
9
            return false;
5
            return false;
10
        }
6
        }
11
        XYShapeAnnotation that = (XYShapeAnnotation) obj;
7
        DateAxis that = (DateAxis) obj;
12
        if (!this.shape.equals(that.shape)) {
8
        if (!ObjectUtilities.equal(this.tickUnit, that.tickUnit)) {
13
            return false;
9
            return false;
14
        }
10
        }
15
        if (!ObjectUtilities.equal(this.stroke, that.strok
11
        if (!ObjectUtilities.equal(this.dateFormatOverride,
16
e)) {
12
                that.dateFormatOverride)) {
17
            return false;
13
            return false;
18
        }
14
        }
19
        if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint
15
        if (!ObjectUtilities.equal(this.tickMarkPosition,
20
)) {
16
                that.tickMarkPosition)) {
21
            return false;
17
            return false;
22
        }
18
        }
23
        if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) {
19
        if (!ObjectUtilities.equal(this.timeline, that.timeline)) {
24
            return false;
20
            return false;
25
        }
21
        }
26
        // seem to be the same
22
        if (!super.equals(obj)) {
23
            return false;
24
        }
27
        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.5
Clones locationClones are in different classes
Number of node comparisons119
  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)6.0
    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))
    14
    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
    14
    if (!super.equals(obj))
    4
    return false;
    15
    return false;
    5
    if (!(obj instanceof XYShapeAnnotation))
    5
    if (!(obj instanceof XYShapeAnnotation))
    3
    if (!(obj instanceof DateAxis))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    3
    if (!(obj instanceof DateAxis))
    6
    return false;
    4
    return false;
    7
    XYShapeAnnotation that = (XYShapeAnnotation)obj;
    7
    XYShapeAnnotation that = (XYShapeAnnotation)obj;
    5
    DateAxis that = (DateAxis)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    5
    DateAxis that = (DateAxis)obj;
    8
    if (!this.shape.equals(that.shape))
    8
    if (!this.shape.equals(that.shape))
    8
    if (!ObjectUtilities.equal(this.dateFormatOverride, that.dateFormatOverride))
    Differences
    Expression1Expression2Difference
    this.shape.equals(that.shape)ObjectUtilities.equal(this.dateFormatOverride,that.dateFormatOverride)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.shape.equals(that.shape) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ObjectUtilities.equal(this.dateFormatOverride,that.dateFormatOverride) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (!ObjectUtilities.equal(this.dateFormatOverride, that.dateFormatOverride))
    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.tickMarkPosition, that.tickMarkPosition))
    Differences
    Expression1Expression2Difference
    stroketickMarkPositionVARIABLE_NAME_MISMATCH
    java.awt.Strokeorg.jfree.chart.axis.DateTickMarkPositionVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    stroketickMarkPositionVARIABLE_NAME_MISMATCH
    java.awt.Strokeorg.jfree.chart.axis.DateTickMarkPositionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable this.stroke does not match with type org.jfree.chart.axis.DateTickMarkPosition of variable this.tickMarkPosition
    • Make classes java.awt.Stroke and org.jfree.chart.axis.DateTickMarkPosition extend a common superclass
    Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.tickMarkPosition cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Stroke of variable that.stroke does not match with type org.jfree.chart.axis.DateTickMarkPosition of variable that.tickMarkPosition
    • Make classes java.awt.Stroke and org.jfree.chart.axis.DateTickMarkPosition extend a common superclass
    10
    if (!ObjectUtilities.equal(this.tickMarkPosition, that.tickMarkPosition))
    11
    return false;
    11
    return false;
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    12
    if (!ObjectUtilities.equal(this.timeline, that.timeline))
    Differences
    Expression1Expression2Difference
    outlinePainttimelineVARIABLE_NAME_MISMATCH
    java.awt.Paintorg.jfree.chart.axis.TimelineVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    outlinePainttimelineVARIABLE_NAME_MISMATCH
    java.awt.Paintorg.jfree.chart.axis.TimelineVARIABLE_TYPE_MISMATCH
    org.jfree.util.PaintUtilitiesorg.jfree.util.ObjectUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable this.outlinePaint does not match with type org.jfree.chart.axis.Timeline of variable this.timeline
    • Make classes java.awt.Paint and org.jfree.chart.axis.Timeline extend a common superclass
    Expression that.outlinePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.timeline cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Paint of variable that.outlinePaint does not match with type org.jfree.chart.axis.Timeline of variable that.timeline
    • Make classes java.awt.Paint and org.jfree.chart.axis.Timeline 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.timeline, that.timeline))
    13
    return false;
    13
    return false;
    14
    if (!PaintUtilities.equal(this.fillPaint, that.fillPaint))
    14
    if (!PaintUtilities.equal(this.fillPaint, that.fillPaint))
    6
    if (!ObjectUtilities.equal(this.tickUnit, that.tickUnit))
    Differences
    Expression1Expression2Difference
    fillPainttickUnitVARIABLE_NAME_MISMATCH
    java.awt.Paintorg.jfree.chart.axis.DateTickUnitVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    fillPainttickUnitVARIABLE_NAME_MISMATCH
    java.awt.Paintorg.jfree.chart.axis.DateTickUnitVARIABLE_TYPE_MISMATCH
    org.jfree.util.PaintUtilitiesorg.jfree.util.ObjectUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable this.fillPaint does not match with type org.jfree.chart.axis.DateTickUnit of variable this.tickUnit
    • Make classes java.awt.Paint and org.jfree.chart.axis.DateTickUnit extend a common superclass
    Expression that.fillPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.tickUnit cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Paint of variable that.fillPaint does not match with type org.jfree.chart.axis.DateTickUnit of variable that.tickUnit
    • Make classes java.awt.Paint and org.jfree.chart.axis.DateTickUnit 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
    6
    if (!ObjectUtilities.equal(this.tickUnit, that.tickUnit))
    15
    return false;
    7
    return false;
    16
    return true;
    16
    return true;
    Precondition Violations (19)
    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 this.shape.equals(that.shape) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression ObjectUtilities.equal(this.dateFormatOverride,that.dateFormatOverride) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type java.awt.Stroke of variable this.stroke does not match with type org.jfree.chart.axis.DateTickMarkPosition of variable this.tickMarkPosition
    6Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression that.tickMarkPosition cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Type java.awt.Stroke of variable that.stroke does not match with type org.jfree.chart.axis.DateTickMarkPosition of variable that.tickMarkPosition
    9Type java.awt.Paint of variable this.outlinePaint does not match with type org.jfree.chart.axis.Timeline of variable this.timeline
    10Expression that.outlinePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression that.timeline cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Type java.awt.Paint of variable that.outlinePaint does not match with type org.jfree.chart.axis.Timeline of variable that.timeline
    13Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    14Type java.awt.Paint of variable this.fillPaint does not match with type org.jfree.chart.axis.DateTickUnit of variable this.tickUnit
    15Expression that.fillPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Expression that.tickUnit cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Type java.awt.Paint of variable that.fillPaint does not match with type org.jfree.chart.axis.DateTickUnit of variable that.tickUnit
    18Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    19The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYShapeAnnotation and org.jfree.chart.axis.DateAxis do not have a common superclass