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 NumberAxis)) { return false; } if (!super.equals(obj)) { return false; } NumberAxis that = (NumberAxis) obj; if (this.autoRangeIncludesZero != that.autoRangeIncludesZero) { return false; } if (this.autoRangeStickyZero != that.autoRangeStickyZero) { return false; } if (!ObjectUtilities.equal(this.tickUnit, that.tickUnit)) { return false; } if (!ObjectUtilities.equal(this.numberFormatOverride, that.numberFormatOverride)) { return false; } if (!this.rangeType.equals(that.rangeType)) { 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/NumberAxis.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 16 Number of AST nodes: 18
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)) {
5
if (!(obj instanceof NumberAxis)) {
6
            return false;
6
            return false;
7
        }
7
        }
8
        if (!(obj instanceof XYPolygonAnnotation)) {
8
        if (!super.equals(obj)) {
9
            return false;
9
            return false;
10
        }
10
        }
11
        XYPolygonAnnotation that = (XYPolygonAnnotation) obj;
11
        NumberAxis that = (NumberAxis) obj;
12
        if (!Arrays.equals(this.polygon, that.polygon)) {
12
        if (this.autoRangeIncludesZero != that.autoRangeIncludesZero) {
13
            return false;   
13
            return false;
14
        }
14
        }
15
        if (!ObjectUtilities.equal(this.stroke, that.stroke)) {
15
        if (this.autoRangeStickyZero != that.autoRangeStickyZero) {
16
            return false;
16
            return false;
17
        }
17
        }
18
        if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) {
18
        if (!ObjectUtilities.equal(this.tickUnit, that.tickUnit)) {
19
            return false;
19
            return false;
20
        }
20
        }
21
        if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) {
21
        if (!ObjectUtilities.equal(this.
22
            return false;
23
        }
24
        // seem to be the same
22
numberFormatOverride,
23
                that.numberFormatOverride)) {
24
            return false;
25
        }
26
        if (!this.rangeType.equals(that.rangeType)) {
27
            return false;
28
        }
25
        return true;
29
        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.0
Clones locationClones are in different classes
Number of node comparisons99
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)7.1
    Clone typeType 3
    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))
    5
    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
    5
    if (!super.equals(obj))
    4
    return false;
    6
    return false;
    5
    if (!(obj instanceof XYPolygonAnnotation))
    5
    if (!(obj instanceof XYPolygonAnnotation))
    3
    if (!(obj instanceof NumberAxis))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    3
    if (!(obj instanceof NumberAxis))
    6
    return false;
    4
    return false;
    7
    XYPolygonAnnotation that = (XYPolygonAnnotation)obj;
    7
    XYPolygonAnnotation that = (XYPolygonAnnotation)obj;
    7
    NumberAxis that = (NumberAxis)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    7
    NumberAxis that = (NumberAxis)obj;
                                                                                                                                  
    8
    if (this.autoRangeIncludesZero != that.autoRangeIncludesZero)
    Preondition Violations
    Unmatched statement if(this.autoRangeIncludesZero != that.autoRangeIncludesZero) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    if (this.autoRangeIncludesZero != that.autoRangeIncludesZero)
                                    
    9
    return false;
    Preondition Violations
    Unmatched return false;
    9
    return false;
                                                                                                                            
    10
    if (this.autoRangeStickyZero != that.autoRangeStickyZero)
    Preondition Violations
    Unmatched statement if(this.autoRangeStickyZero != that.autoRangeStickyZero) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    if (this.autoRangeStickyZero != that.autoRangeStickyZero)
                                      
    11
    return false;
    Preondition Violations
    Unmatched return false;
    11
    return false;
    8
    if (!Arrays.equals(this.polygon, that.polygon))
    8
    if (!Arrays.equals(this.polygon, that.polygon))
    16
    if (!this.rangeType.equals(that.rangeType))
    Differences
    Expression1Expression2Difference
    Arrays.equals(this.polygon,that.polygon)this.rangeType.equals(that.rangeType)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.rangeType.equals(that.rangeType) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16
    if (!this.rangeType.equals(that.rangeType))
    9
    return false;
    17
    return false;
    10
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    10
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    12
    if (!ObjectUtilities.equal(this.tickUnit, that.tickUnit))
    Differences
    Expression1Expression2Difference
    stroketickUnitVARIABLE_NAME_MISMATCH
    java.awt.Strokeorg.jfree.chart.axis.NumberTickUnitVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    stroketickUnitVARIABLE_NAME_MISMATCH
    java.awt.Strokeorg.jfree.chart.axis.NumberTickUnitVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable this.stroke does not match with type org.jfree.chart.axis.NumberTickUnit of variable this.tickUnit
    • Make classes java.awt.Stroke and org.jfree.chart.axis.NumberTickUnit extend a common superclass
    Expression that.stroke 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.Stroke of variable that.stroke does not match with type org.jfree.chart.axis.NumberTickUnit of variable that.tickUnit
    • Make classes java.awt.Stroke and org.jfree.chart.axis.NumberTickUnit extend a common superclass
    12
    if (!ObjectUtilities.equal(this.tickUnit, that.tickUnit))
    11
    return false;
    13
    return false;
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    14
    if (!ObjectUtilities.equal(this.numberFormatOverride, that.numberFormatOverride))
    Differences
    Expression1Expression2Difference
    outlinePaintnumberFormatOverrideVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.text.NumberFormatVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    outlinePaintnumberFormatOverrideVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.text.NumberFormatVARIABLE_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 java.text.NumberFormat of variable this.numberFormatOverride
    • Make classes java.awt.Paint and java.text.NumberFormat extend a common superclass
    Expression that.outlinePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.numberFormatOverride 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 java.text.NumberFormat of variable that.numberFormatOverride
    • Make classes java.awt.Paint and java.text.NumberFormat 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
    14
    if (!ObjectUtilities.equal(this.numberFormatOverride, that.numberFormatOverride))
    13
    return false;
    15
    return false;
    Precondition Violations (20)
    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
    3Unmatched statement if(this.autoRangeIncludesZero != that.autoRangeIncludesZero) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return false;
    5Unmatched statement if(this.autoRangeStickyZero != that.autoRangeStickyZero) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched return false;
    7Expression Arrays.equals(this.polygon,that.polygon) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression this.rangeType.equals(that.rangeType) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type java.awt.Stroke of variable this.stroke does not match with type org.jfree.chart.axis.NumberTickUnit of variable this.tickUnit
    10Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression that.tickUnit cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Type java.awt.Stroke of variable that.stroke does not match with type org.jfree.chart.axis.NumberTickUnit of variable that.tickUnit
    13Type java.awt.Paint of variable this.outlinePaint does not match with type java.text.NumberFormat of variable this.numberFormatOverride
    14Expression that.outlinePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression that.numberFormatOverride cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Type java.awt.Paint of variable that.outlinePaint does not match with type java.text.NumberFormat of variable that.numberFormatOverride
    17Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    18Clone 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.NumberAxis
    19Not all possible execution flows end in a return statement
    20The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYPolygonAnnotation and org.jfree.chart.axis.NumberAxis do not have a common superclass