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 StandardDialRange)) { return false; } StandardDialRange that = (StandardDialRange) obj; if (this.scaleIndex != that.scaleIndex) { return false; } if (this.lowerBound != that.lowerBound) { return false; } if (this.upperBound != that.upperBound) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (this.innerRadius != that.innerRadius) { return false; } if (this.outerRadius != that.outerRadius) { return false; } return super.equals(obj);
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/plot/dial/StandardDialRange.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 StandardDialRange)) {
9
            return false;
5
            return false;
10
        }
6
        }
11
        XYDrawableAnnotation that = (XYDrawableAnnotation) obj;
7
        StandardDialRange that = (StandardDialRange) obj;
12
        if (this.x != that.x) {
8
        if (this.scaleIndex != that.scaleIndex) {
13
            return false;
9
            return false;
14
        }
10
        }
15
        if (this.y != that.y) {
11
        if (this.lowerBound != that.lowerBound) {
16
            return false;
12
            return false;
17
        }
13
        }
18
        if (this.width != that.width) {
14
        if (this.upperBound != that.upperBound) {
19
            return false;
15
            return false;
20
        }
16
        }
21
        if (this.height != that.height) {
17
        if (!PaintUtilities.equal(this.paint, that.paint)) {
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...
28
        return true
21
this.innerRadius != that.innerRadius) {
22
            return false;
23
        }
24
        if (this.outerRadius != that.outerRadius) {
25
            return false;
26
        }
29
;
27
        return super.equals(obj);
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.6
Clones locationClones are in different classes
Number of node comparisons107
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)5.1
    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 StandardDialRange))
    Differences
    Expression1Expression2Difference
    super.equals(obj)(obj instanceof StandardDialRange)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Super method call if(!super.equals(obj)) cannot be extracted from method
    3
    if (!(obj instanceof StandardDialRange))
    4
    return false;
    4
    return false;
                                                                                                      
    5
    StandardDialRange that = (StandardDialRange)obj;
    5
    if (!(obj instanceof XYDrawableAnnotation))
    5
    if (!(obj instanceof XYDrawableAnnotation))
    12
    if (!PaintUtilities.equal(this.paint, that.paint))
    Differences
    Expression1Expression2Difference
    (obj instanceof XYDrawableAnnotation)PaintUtilities.equal(this.paint,that.paint)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression PaintUtilities.equal(this.paint,that.paint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    if (!PaintUtilities.equal(this.paint, that.paint))
    6
    return false;
    13
    return false;
    7
    XYDrawableAnnotation that = (XYDrawableAnnotation)obj;
                                                                                                                  
    8
    if (this.x != that.x)
    8
    if (this.x != that.x)
    8
    if (this.lowerBound != that.lowerBound)
    Differences
    Expression1Expression2Difference
    xlowerBoundVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYDrawableAnnotationorg.jfree.chart.plot.dial.StandardDialRangeSUBCLASS_TYPE_MISMATCH
    xlowerBoundVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.lowerBound cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (this.lowerBound != that.lowerBound)
    9
    return false;
    9
    return false;
    10
    if (this.y != that.y)
    10
    if (this.y != that.y)
    10
    if (this.upperBound != that.upperBound)
    Differences
    Expression1Expression2Difference
    yupperBoundVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYDrawableAnnotationorg.jfree.chart.plot.dial.StandardDialRangeSUBCLASS_TYPE_MISMATCH
    yupperBoundVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.upperBound cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (this.upperBound != that.upperBound)
    11
    return false;
    11
    return false;
    12
    if (this.width != that.width)
    12
    if (this.width != that.width)
    14
    if (this.innerRadius != that.innerRadius)
    Differences
    Expression1Expression2Difference
    widthinnerRadiusVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYDrawableAnnotationorg.jfree.chart.plot.dial.StandardDialRangeSUBCLASS_TYPE_MISMATCH
    widthinnerRadiusVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.innerRadius cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14
    if (this.innerRadius != that.innerRadius)
    13
    return false;
    15
    return false;
    14
    if (this.height != that.height)
    14
    if (this.height != that.height)
    6
    if (this.scaleIndex != that.scaleIndex)
    Differences
    Expression1Expression2Difference
    heightscaleIndexVARIABLE_NAME_MISMATCH
    doubleintVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYDrawableAnnotationorg.jfree.chart.plot.dial.StandardDialRangeSUBCLASS_TYPE_MISMATCH
    heightscaleIndexVARIABLE_NAME_MISMATCH
    doubleintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double of variable this.height does not match with type int of variable this.scaleIndex
    Expression that.height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.scaleIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type double of variable that.height does not match with type int of variable that.scaleIndex
    6
    if (this.scaleIndex != that.scaleIndex)
    15
    return false;
    7
    return false;
    Precondition Violations (14)
    Row Violation
    1Super method call if(!super.equals(obj)) cannot be extracted from method
    2Expression PaintUtilities.equal(this.paint,that.paint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression that.lowerBound cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression that.upperBound cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression that.width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression that.innerRadius cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type double of variable this.height does not match with type int of variable this.scaleIndex
    10Expression that.height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression that.scaleIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Type double of variable that.height does not match with type int of variable that.scaleIndex
    13Not all possible execution flows end in a return statement
    14The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYDrawableAnnotation and org.jfree.chart.plot.dial.StandardDialRange do not have a common superclass