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; } 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/XYPolygonAnnotation.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 XYPolygonAnnotation)) {
4
        if (!(obj instanceof DateAxis)) {
9
            return false;
5
            return false;
10
        }
6
        }
11
        XYPolygonAnnotation that = (XYPolygonAnnotation) obj;
7
        DateAxis that = (DateAxis) obj;
12
        if (!Arrays.equals(this.polygon, that.polygon)) {
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)6.6
Clones locationClones are in different classes
Number of node comparisons116
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)6.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj == this)
    1
    if (obj == this)
    2
    return true;
    2
    return true;
                                                                                                                        
    6
    if (!ObjectUtilities.equal(this.tickUnit, that.tickUnit))
    Preondition Violations
    Unmatched statement if(!ObjectUtilities.equal(this.tickUnit,that.tickUnit)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    if (!ObjectUtilities.equal(this.tickUnit, that.tickUnit))
                                    
    7
    return false;
    Preondition Violations
    Unmatched return false;
    7
    return false;
    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 XYPolygonAnnotation))
    5
    if (!(obj instanceof XYPolygonAnnotation))
    3
    if (!(obj instanceof DateAxis))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    3
    if (!(obj instanceof DateAxis))
    6
    return false;
    4
    return false;
    7
    XYPolygonAnnotation that = (XYPolygonAnnotation)obj;
    7
    XYPolygonAnnotation that = (XYPolygonAnnotation)obj;
    5
    DateAxis that = (DateAxis)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    5
    DateAxis that = (DateAxis)obj;
    8
    if (!Arrays.equals(this.polygon, that.polygon))
    8
    if (!Arrays.equals(this.polygon, that.polygon))
    Preondition Violations
    Unmatched statement if(!Arrays.equals(this.polygon,that.polygon)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                    
    9
    return false;
    9
    return false;
    Preondition Violations
    Unmatched 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.XYPolygonAnnotationorg.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.XYPolygonAnnotationorg.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))
    8
    if (!ObjectUtilities.equal(this.dateFormatOverride, that.dateFormatOverride))
    Differences
    Expression1Expression2Difference
    fillPaintdateFormatOverrideVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.text.DateFormatVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.axis.DateAxisSUBCLASS_TYPE_MISMATCH
    fillPaintdateFormatOverrideVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.text.DateFormatVARIABLE_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 java.text.DateFormat of variable this.dateFormatOverride
    • Make classes java.awt.Paint and java.text.DateFormat extend a common superclass
    Expression that.fillPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.dateFormatOverride 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 java.text.DateFormat of variable that.dateFormatOverride
    • Make classes java.awt.Paint and java.text.DateFormat 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
    8
    if (!ObjectUtilities.equal(this.dateFormatOverride, that.dateFormatOverride))
    15
    return false;
    9
    return false;
    16
    return true;
    16
    return true;
    Precondition Violations (23)
    Row Violation
    1Unmatched statement if(!ObjectUtilities.equal(this.tickUnit,that.tickUnit)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched return false;
    3Super method call if(!super.equals(obj)) cannot be extracted from method
    4Super method call if(!super.equals(obj)) cannot be extracted from method
    5Unmatched statement if(!Arrays.equals(this.polygon,that.polygon)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched return false;
    7Type java.awt.Stroke of variable this.stroke does not match with type org.jfree.chart.axis.DateTickMarkPosition of variable this.tickMarkPosition
    8Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression that.tickMarkPosition cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Type java.awt.Stroke of variable that.stroke does not match with type org.jfree.chart.axis.DateTickMarkPosition of variable that.tickMarkPosition
    11Type java.awt.Paint of variable this.outlinePaint does not match with type org.jfree.chart.axis.Timeline of variable this.timeline
    12Expression that.outlinePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression that.timeline cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Type java.awt.Paint of variable that.outlinePaint does not match with type org.jfree.chart.axis.Timeline of variable that.timeline
    15Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    16Type java.awt.Paint of variable this.fillPaint does not match with type java.text.DateFormat of variable this.dateFormatOverride
    17Expression that.fillPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Expression that.dateFormatOverride cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19Type java.awt.Paint of variable that.fillPaint does not match with type java.text.DateFormat of variable that.dateFormatOverride
    20Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    21Clone fragment #1 returns variable that with type org.jfree.chart.annotations.XYPolygonAnnotation , while Clone fragment #2 returns variable that with type org.jfree.chart.axis.DateAxis
    22Not all possible execution flows end in a return statement
    23The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYPolygonAnnotation and org.jfree.chart.axis.DateAxis do not have a common superclass