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 MarkerAxisBand)) { return false; } MarkerAxisBand that = (MarkerAxisBand) obj; if (this.topOuterGap != that.topOuterGap) { return false; } if (this.topInnerGap != that.topInnerGap) { return false; } if (this.bottomInnerGap != that.bottomInnerGap) { return false; } if (this.bottomOuterGap != that.bottomOuterGap) { return false; } if (!ObjectUtilities.equal(this.font, that.font)) { return false; } if (!ObjectUtilities.equal(this.markers, that.markers)) { 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/MarkerAxisBand.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 MarkerAxisBand)) {
9
            return false;
5
            return false;
10
        }
6
        }
11
        XYDrawableAnnotation that = (XYDrawableAnnotation) obj;
7
        
12
        if (this.x != that.x
8
MarkerAxisBand that = (MarkerAxisBand) obj;
13
) {
9
        if (this.topOuterGap != that.topOuterGap) {
14
            return false;
10
            return false;
15
        }
11
        }
16
        if (this.y != that.y) {
12
        if (this.topInnerGap != that.topInnerGap) {
17
            return false;
13
            return false;
18
        }
14
        }
19
        if (this.width != that.width) {
15
        if (this.bottomInnerGap != that.bottomInnerGap) {
20
            return false;
16
            return false;
21
        }
17
        }
22
        if (this.height != that.height) {
18
        if (this.bottomOuterGap != that.bottomOuterGap) {
23
            return false;
19
            return false;
24
        }
20
        }
25
        if (!ObjectUtilities.equal(this.drawable, that.drawable)) {
21
        if (!ObjectUtilities.equal(this.font, that.font)) {
26
            return false;
22
            return false;
27
        }
23
        }
28
        // seem to be the same...
24
        if (!ObjectUtilities.equal(this.markers, that.markers)) {
25
            return false;
26
        }
29
        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)4.2
Clones locationClones are in different classes
Number of node comparisons119
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements17
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)4.9
    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 MarkerAxisBand))
    Differences
    Expression1Expression2Difference
    super.equals(obj)(obj instanceof MarkerAxisBand)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Super method call if(!super.equals(obj)) cannot be extracted from method
    3
    if (!(obj instanceof MarkerAxisBand))
    4
    return false;
    4
    return false;
                                                                                          
    5
    MarkerAxisBand that = (MarkerAxisBand)obj;
    5
    if (!(obj instanceof XYDrawableAnnotation))
    5
    if (!(obj instanceof XYDrawableAnnotation))
    14
    if (!ObjectUtilities.equal(this.font, that.font))
    Differences
    Expression1Expression2Difference
    (obj instanceof XYDrawableAnnotation)ObjectUtilities.equal(this.font,that.font)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.font,that.font) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14
    if (!ObjectUtilities.equal(this.font, that.font))
    6
    return false;
    15
    return false;
    7
    XYDrawableAnnotation that = (XYDrawableAnnotation)obj;
                                                                                                                  
    8
    if (this.x != that.x)
    8
    if (this.x != that.x)
    8
    if (this.topInnerGap != that.topInnerGap)
    Differences
    Expression1Expression2Difference
    xtopInnerGapVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYDrawableAnnotationorg.jfree.chart.axis.MarkerAxisBandVARIABLE_TYPE_MISMATCH
    xtopInnerGapVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type double of variable that.x does not match with type double of variable that.topInnerGap
    • Make classes org.jfree.chart.annotations.XYDrawableAnnotation and org.jfree.chart.axis.MarkerAxisBand extend a common superclass
    Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.topInnerGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (this.topInnerGap != that.topInnerGap)
    9
    return false;
    9
    return false;
    10
    if (this.y != that.y)
    10
    if (this.y != that.y)
    10
    if (this.bottomInnerGap != that.bottomInnerGap)
    Differences
    Expression1Expression2Difference
    ybottomInnerGapVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYDrawableAnnotationorg.jfree.chart.axis.MarkerAxisBandVARIABLE_TYPE_MISMATCH
    ybottomInnerGapVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type double of variable that.y does not match with type double of variable that.bottomInnerGap
    • Make classes org.jfree.chart.annotations.XYDrawableAnnotation and org.jfree.chart.axis.MarkerAxisBand extend a common superclass
    Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.bottomInnerGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (this.bottomInnerGap != that.bottomInnerGap)
    11
    return false;
    11
    return false;
    12
    if (this.width != that.width)
    12
    if (this.width != that.width)
    12
    if (this.bottomOuterGap != that.bottomOuterGap)
    Differences
    Expression1Expression2Difference
    widthbottomOuterGapVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYDrawableAnnotationorg.jfree.chart.axis.MarkerAxisBandVARIABLE_TYPE_MISMATCH
    widthbottomOuterGapVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type double of variable that.width does not match with type double of variable that.bottomOuterGap
    • Make classes org.jfree.chart.annotations.XYDrawableAnnotation and org.jfree.chart.axis.MarkerAxisBand extend a common superclass
    Expression that.width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.bottomOuterGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    if (this.bottomOuterGap != that.bottomOuterGap)
    13
    return false;
    13
    return false;
    14
    if (this.height != that.height)
    14
    if (this.height != that.height)
    6
    if (this.topOuterGap != that.topOuterGap)
    Differences
    Expression1Expression2Difference
    heighttopOuterGapVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYDrawableAnnotationorg.jfree.chart.axis.MarkerAxisBandVARIABLE_TYPE_MISMATCH
    heighttopOuterGapVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type double of variable that.height does not match with type double of variable that.topOuterGap
    • Make classes org.jfree.chart.annotations.XYDrawableAnnotation and org.jfree.chart.axis.MarkerAxisBand extend a common superclass
    Expression that.height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.topOuterGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (this.topOuterGap != that.topOuterGap)
    15
    return false;
    7
    return false;
    16
    if (!ObjectUtilities.equal(this.drawable, that.drawable))
    16
    if (!ObjectUtilities.equal(this.drawable, that.drawable))
    16
    if (!ObjectUtilities.equal(this.markers, that.markers))
    Differences
    Expression1Expression2Difference
    drawablemarkersVARIABLE_NAME_MISMATCH
    org.jfree.ui.Drawablejava.util.ListVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYDrawableAnnotationorg.jfree.chart.axis.MarkerAxisBandVARIABLE_TYPE_MISMATCH
    drawablemarkersVARIABLE_NAME_MISMATCH
    org.jfree.ui.Drawablejava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.ui.Drawable of variable this.drawable does not match with type java.util.List of variable this.markers
    • Make classes org.jfree.ui.Drawable and java.util.List extend a common superclass
    Type org.jfree.ui.Drawable of variable that.drawable does not match with type java.util.List of variable that.markers
    • Make classes org.jfree.chart.annotations.XYDrawableAnnotation and org.jfree.chart.axis.MarkerAxisBand extend a common superclass
    Expression that.drawable cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.markers cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.ui.Drawable of variable that.drawable does not match with type java.util.List of variable that.markers
    • Make classes org.jfree.ui.Drawable and java.util.List extend a common superclass
    16
    if (!ObjectUtilities.equal(this.markers, that.markers))
    17
    return false;
    17
    return false;
    18
    return true;
    18
    return true;
    Precondition Violations (20)
    Row Violation
    1Super method call if(!super.equals(obj)) cannot be extracted from method
    2Expression ObjectUtilities.equal(this.font,that.font) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type double of variable that.x does not match with type double of variable that.topInnerGap
    4Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.topInnerGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type double of variable that.y does not match with type double of variable that.bottomInnerGap
    7Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression that.bottomInnerGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type double of variable that.width does not match with type double of variable that.bottomOuterGap
    10Expression that.width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression that.bottomOuterGap 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 double of variable that.topOuterGap
    13Expression that.height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression that.topOuterGap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Type org.jfree.ui.Drawable of variable this.drawable does not match with type java.util.List of variable this.markers
    16Type org.jfree.ui.Drawable of variable that.drawable does not match with type java.util.List of variable that.markers
    17Expression that.drawable cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Expression that.markers cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19Type org.jfree.ui.Drawable of variable that.drawable does not match with type java.util.List of variable that.markers
    20The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYDrawableAnnotation and org.jfree.chart.axis.MarkerAxisBand do not have a common superclass