if (obj == this) { // simple case return true; } // now try to reject equality... if (!super.equals(obj)) { return false; } if (!(obj instanceof XYDrawableAnnotation)) { return false; } XYDrawableAnnotation that = (XYDrawableAnnotation) obj; if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (this.width != that.width) { return false; } if (this.height != that.height) { return false; } if (!ObjectUtilities.equal(this.drawable, that.drawable)) { return false; } // seem to be the same... return true;
if (obj == this) { return true; } if (!(obj instanceof CategoryLabelPosition)) { return false; } CategoryLabelPosition that = (CategoryLabelPosition) obj; if (!this.categoryAnchor.equals(that.categoryAnchor)) { return false; } if (!this.labelAnchor.equals(that.labelAnchor)) { return false; } if (!this.rotationAnchor.equals(that.rotationAnchor)) { return false; } if (this.angle != that.angle) { return false; } if (this.widthType != that.widthType) { return false; } if (this.widthRatio != that.widthRatio) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYDrawableAnnotation.java File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/CategoryLabelPosition.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 18 Number of AST nodes: 18
1
if (obj == this) { // simple case
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 XYDrawableAnnotation)) {
4
        if (!(obj instanceof CategoryLabelPosition)) {
9
            return false;
5
            return false;
10
        }
6
        }
11
        XYDrawableAnnotation that = (XYDrawableAnnotation) obj;
7
        CategoryLabelPosition that = (CategoryLabelPosition) obj;
12
        if (this.x != that.x) {
8
        if (!this.categoryAnchor.equals(that.categoryAnchor)) {
13
            return false;
9
            return false;
14
        }
10
        }
15
        if (this.y != that.y) {
11
        if (!this.labelAnchor.equals(that.labelAnchor)) {
16
            return false;
12
            return false;
17
        }
13
        }
18
        if (this.width != that.width) {
14
        if (!this.rotationAnchor.equals(that.rotationAnchor)) {
19
            return false;
15
            return false;
20
        }
16
        }
21
        if (this.height != that.height) {
17
        if (this.angle != that.angle) {
22
            return false;
18
            return false;
23
        }
19
        }
24
        if (!ObjectUtilities.equal(this.drawable, that.drawable)) {
20
        if (
25
            return false;
26
        }
27
        // seem to be the same...
21
this.widthType != that.widthType) {
22
            return false;
23
        }
24
        if (this.widthRatio != that.widthRatio) {
25
            return false;
26
        }
28
        return true;
27
        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)3.8
Clones locationClones are in different classes
Number of node comparisons113
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)4.9
    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))
    3
    if (!(obj instanceof CategoryLabelPosition))
    Differences
    Expression1Expression2Difference
    super.equals(obj)(obj instanceof CategoryLabelPosition)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Super method call if(!super.equals(obj)) cannot be extracted from method
    3
    if (!(obj instanceof CategoryLabelPosition))
    4
    return false;
    4
    return false;
                                                                                                                      
    5
    CategoryLabelPosition that = (CategoryLabelPosition)obj;
    5
    if (!(obj instanceof XYDrawableAnnotation))
    5
    if (!(obj instanceof XYDrawableAnnotation))
    6
    if (!this.categoryAnchor.equals(that.categoryAnchor))
    Differences
    Expression1Expression2Difference
    (obj instanceof XYDrawableAnnotation)this.categoryAnchor.equals(that.categoryAnchor)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.categoryAnchor.equals(that.categoryAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (!this.categoryAnchor.equals(that.categoryAnchor))
    6
    return false;
    7
    return false;
    7
    XYDrawableAnnotation that = (XYDrawableAnnotation)obj;
                                                                                                                  
                                                                                                      
    8
    if (!this.labelAnchor.equals(that.labelAnchor))
                                    
    9
    return false;
    Preondition Violations
    Unmatched return false;
    9
    return false;
    8
    if (this.x != that.x)
    8
    if (this.x != that.x)
    12
    if (this.angle != that.angle)
    Differences
    Expression1Expression2Difference
    xangleVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYDrawableAnnotationorg.jfree.chart.axis.CategoryLabelPositionVARIABLE_TYPE_MISMATCH
    xangleVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type double of variable that.x does not match with type double of variable that.angle
    • Make classes org.jfree.chart.annotations.XYDrawableAnnotation and org.jfree.chart.axis.CategoryLabelPosition extend a common superclass
    Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.angle cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    if (this.angle != that.angle)
    9
    return false;
    13
    return false;
    10
    if (this.y != that.y)
    10
    if (this.y != that.y)
    14
    if (this.widthType != that.widthType)
    Differences
    Expression1Expression2Difference
    ywidthTypeVARIABLE_NAME_MISMATCH
    doubleorg.jfree.chart.axis.CategoryLabelWidthTypeVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYDrawableAnnotationorg.jfree.chart.axis.CategoryLabelPositionVARIABLE_TYPE_MISMATCH
    ywidthTypeVARIABLE_NAME_MISMATCH
    doubleorg.jfree.chart.axis.CategoryLabelWidthTypeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double of variable this.y does not match with type org.jfree.chart.axis.CategoryLabelWidthType of variable this.widthType
    Type double of variable that.y does not match with type org.jfree.chart.axis.CategoryLabelWidthType of variable that.widthType
    • Make classes org.jfree.chart.annotations.XYDrawableAnnotation and org.jfree.chart.axis.CategoryLabelPosition extend a common superclass
    Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.widthType cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type double of variable that.y does not match with type org.jfree.chart.axis.CategoryLabelWidthType of variable that.widthType
    14
    if (this.widthType != that.widthType)
    11
    return false;
    15
    return false;
    12
    if (this.width != that.width)
    12
    if (this.width != that.width)
    16
    if (this.widthRatio != that.widthRatio)
    Differences
    Expression1Expression2Difference
    widthwidthRatioVARIABLE_NAME_MISMATCH
    doublefloatVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYDrawableAnnotationorg.jfree.chart.axis.CategoryLabelPositionVARIABLE_TYPE_MISMATCH
    widthwidthRatioVARIABLE_NAME_MISMATCH
    doublefloatVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double of variable this.width does not match with type float of variable this.widthRatio
    Type double of variable that.width does not match with type float of variable that.widthRatio
    • Make classes org.jfree.chart.annotations.XYDrawableAnnotation and org.jfree.chart.axis.CategoryLabelPosition extend a common superclass
    Expression that.width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.widthRatio cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type double of variable that.width does not match with type float of variable that.widthRatio
    16
    if (this.widthRatio != that.widthRatio)
    13
    return false;
    17
    return false;
    14
    if (this.height != that.height)
                                                                        
    15
    return false;
    15
    return false;
    Preondition Violations
    Unmatched return false;
                                      
    16
    if (!ObjectUtilities.equal(this.drawable, that.drawable))
    16
    if (!ObjectUtilities.equal(this.drawable, that.drawable))
    10
    if (!this.rotationAnchor.equals(that.rotationAnchor))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.drawable,that.drawable)this.rotationAnchor.equals(that.rotationAnchor)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.drawable,that.drawable) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.rotationAnchor.equals(that.rotationAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (!this.rotationAnchor.equals(that.rotationAnchor))
    17
    return false;
    11
    return false;
    Precondition Violations (21)
    Row Violation
    1Super method call if(!super.equals(obj)) cannot be extracted from method
    2Expression this.categoryAnchor.equals(that.categoryAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched return false;
    4Type double of variable that.x does not match with type double of variable that.angle
    5Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression that.angle cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Type double of variable this.y does not match with type org.jfree.chart.axis.CategoryLabelWidthType of variable this.widthType
    8Type double of variable that.y does not match with type org.jfree.chart.axis.CategoryLabelWidthType of variable that.widthType
    9Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression that.widthType cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Type double of variable that.y does not match with type org.jfree.chart.axis.CategoryLabelWidthType of variable that.widthType
    12Type double of variable this.width does not match with type float of variable this.widthRatio
    13Type double of variable that.width does not match with type float of variable that.widthRatio
    14Expression that.width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression that.widthRatio cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Type double of variable that.width does not match with type float of variable that.widthRatio
    17Unmatched return false;
    18Expression ObjectUtilities.equal(this.drawable,that.drawable) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19Expression this.rotationAnchor.equals(that.rotationAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    20Not all possible execution flows end in a return statement
    21The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYDrawableAnnotation and org.jfree.chart.axis.CategoryLabelPosition do not have a common superclass