if (obj == this) { return true; } if (!(obj instanceof XYTitleAnnotation)) { return false; } XYTitleAnnotation that = (XYTitleAnnotation) obj; if (this.coordinateType != that.coordinateType) { return false; } if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (this.maxWidth != that.maxWidth) { return false; } if (this.maxHeight != that.maxHeight) { return false; } if (!ObjectUtilities.equal(this.title, that.title)) { return false; } if (!this.anchor.equals(that.anchor)) { return false; } return super.equals(obj);
if (obj == this) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof XYLineAnnotation)) { return false; } XYLineAnnotation that = (XYLineAnnotation) obj; if (this.x1 != that.x1) { return false; } if (this.y1 != that.y1) { return false; } if (this.x2 != that.x2) { return false; } if (this.y2 != that.y2) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } // seems to be the same... return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/experimental/org/jfree/experimental/chart/annotations/XYTitleAnnotation.java File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYLineAnnotation.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 20 Number of AST nodes: 20
1
if (obj == this) {
1
if (obj == this) {
2
            return true;
2
            return true;
3
        }
3
        }
4
        if (!super.equals(obj)) {
5
            return false;
6
        }
4
        if (!(obj instanceof XYTitleAnnotation)) {
7
        if (!(obj instanceof XYLineAnnotation)) {
5
            return false;
8
            return false;
6
        }
9
        }
7
        XYTitleAnnotation that = (XYTitleAnnotation) obj;
10
        XYLineAnnotation that = (XYLineAnnotation) obj;
8
        if (this.coordinateType != that.coordinateType) {
11
        if (this.x1 != that.x1) {
9
            return false;
12
            return false;
10
        }
13
        }
11
        if (this.x != that.x) {
14
        if (this.y1 != that.y1) {
12
            return false;
15
            return false;
13
        }
16
        }
14
        if (this.y != that.y) {
17
        if (this.x2 != that.x2) {
15
            return false;
18
            return false;
16
        }
19
        }
17
        if (this.maxWidth != that.maxWidth) {
20
        if (this.y2 != that.y2) {
18
            return false;
21
            return false;
19
        }
22
        }
20
        if (this.maxHeight != that.maxHeight) {
23
        if (!PaintUtilities.equal(this.paint, that.paint)) {
21
            return false;
24
            return false;
22
        }
25
        }
23
        if (!ObjectUtilities.equal(this.title, that.title)) {
26
        if (!ObjectUtilities.equal(this.stroke, that.stroke)) {
24
            return false;
27
            return false;
25
        }
28
        }
26
        if (!this.anchor.equals(that.anchor)) {
29
        
27
            return false;
28
        }
30
// seems to be the same...
29
        return super.equals(obj);
31
        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)7.2
Clones locationClones are in different classes having the same super class
Number of node comparisons133
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements17
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)9.7
    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 (!(obj instanceof XYTitleAnnotation))
    3
    if (!(obj instanceof XYTitleAnnotation))
    5
    if (!(obj instanceof XYLineAnnotation))
    Differences
    Expression1Expression2Difference
    org.jfree.experimental.chart.annotations.XYTitleAnnotationorg.jfree.chart.annotations.XYLineAnnotationSUBCLASS_TYPE_MISMATCH
    5
    if (!(obj instanceof XYLineAnnotation))
    4
    return false;
    6
    return false;
    5
    XYTitleAnnotation that = (XYTitleAnnotation)obj;
    5
    XYTitleAnnotation that = (XYTitleAnnotation)obj;
    7
    XYLineAnnotation that = (XYLineAnnotation)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.experimental.chart.annotations.XYTitleAnnotationorg.jfree.chart.annotations.XYLineAnnotationSUBCLASS_TYPE_MISMATCH
    org.jfree.experimental.chart.annotations.XYTitleAnnotationorg.jfree.chart.annotations.XYLineAnnotationSUBCLASS_TYPE_MISMATCH
    org.jfree.experimental.chart.annotations.XYTitleAnnotationorg.jfree.chart.annotations.XYLineAnnotationSUBCLASS_TYPE_MISMATCH
    7
    XYLineAnnotation that = (XYLineAnnotation)obj;
    6
    if (this.coordinateType != that.coordinateType)
    6
    if (this.coordinateType != that.coordinateType)
    8
    if (this.x1 != that.x1)
    Differences
    Expression1Expression2Difference
    coordinateTypex1VARIABLE_NAME_MISMATCH
    org.jfree.experimental.chart.util.XYCoordinateTypedoubleVARIABLE_TYPE_MISMATCH
    org.jfree.experimental.chart.annotations.XYTitleAnnotationorg.jfree.chart.annotations.XYLineAnnotationSUBCLASS_TYPE_MISMATCH
    coordinateTypex1VARIABLE_NAME_MISMATCH
    org.jfree.experimental.chart.util.XYCoordinateTypedoubleVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.experimental.chart.util.XYCoordinateType of variable this.coordinateType does not match with type double of variable this.x1
    Expression that.coordinateType cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.x1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.experimental.chart.util.XYCoordinateType of variable that.coordinateType does not match with type double of variable that.x1
    8
    if (this.x1 != that.x1)
    7
    return false;
    9
    return false;
    8
    if (this.x != that.x)
    8
    if (this.x != that.x)
    10
    if (this.y1 != that.y1)
    Differences
    Expression1Expression2Difference
    xy1VARIABLE_NAME_MISMATCH
    org.jfree.experimental.chart.annotations.XYTitleAnnotationorg.jfree.chart.annotations.XYLineAnnotationSUBCLASS_TYPE_MISMATCH
    xy1VARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.y1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (this.y1 != that.y1)
    9
    return false;
    11
    return false;
    10
    if (this.y != that.y)
    10
    if (this.y != that.y)
    12
    if (this.x2 != that.x2)
    Differences
    Expression1Expression2Difference
    yx2VARIABLE_NAME_MISMATCH
    org.jfree.experimental.chart.annotations.XYTitleAnnotationorg.jfree.chart.annotations.XYLineAnnotationSUBCLASS_TYPE_MISMATCH
    yx2VARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.x2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    if (this.x2 != that.x2)
    11
    return false;
    13
    return false;
    12
    if (this.maxWidth != that.maxWidth)
    12
    if (this.maxWidth != that.maxWidth)
    14
    if (this.y2 != that.y2)
    Differences
    Expression1Expression2Difference
    maxWidthy2VARIABLE_NAME_MISMATCH
    org.jfree.experimental.chart.annotations.XYTitleAnnotationorg.jfree.chart.annotations.XYLineAnnotationSUBCLASS_TYPE_MISMATCH
    maxWidthy2VARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.maxWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.y2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14
    if (this.y2 != that.y2)
    13
    return false;
    15
    return false;
    14
    if (this.maxHeight != that.maxHeight)
    14
    if (this.maxHeight != that.maxHeight)
    Preondition Violations
    Unmatched statement if(this.maxHeight != that.maxHeight) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                    
    15
    return false;
    15
    return false;
    Preondition Violations
    Unmatched return false;
                                      
    16
    if (!ObjectUtilities.equal(this.title, that.title))
    16
    if (!ObjectUtilities.equal(this.title, that.title))
    16
    if (!PaintUtilities.equal(this.paint, that.paint))
    Differences
    Expression1Expression2Difference
    titlepaintVARIABLE_NAME_MISMATCH
    org.jfree.chart.title.Titlejava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.experimental.chart.annotations.XYTitleAnnotationorg.jfree.chart.annotations.XYLineAnnotationSUBCLASS_TYPE_MISMATCH
    titlepaintVARIABLE_NAME_MISMATCH
    org.jfree.chart.title.Titlejava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.util.ObjectUtilitiesorg.jfree.util.PaintUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.title.Title of variable this.title does not match with type java.awt.Paint of variable this.paint
    • Make classes org.jfree.chart.title.Title and java.awt.Paint extend a common superclass
    Expression that.title cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.chart.title.Title of variable that.title does not match with type java.awt.Paint of variable that.paint
    • Make classes org.jfree.chart.title.Title and java.awt.Paint extend a common superclass
    Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.PaintUtilities
    • Make classes org.jfree.util.ObjectUtilities and org.jfree.util.PaintUtilities extend a common superclass
    16
    if (!PaintUtilities.equal(this.paint, that.paint))
    17
    return false;
    17
    return false;
    18
    if (!this.anchor.equals(that.anchor))
    18
    if (!this.anchor.equals(that.anchor))
    3
    if (!super.equals(obj))
    Differences
    Expression1Expression2Difference
    this.anchor.equals(that.anchor)super.equals(obj)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.anchor.equals(that.anchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Super method call if(!super.equals(obj)) cannot be extracted from method
    3
    if (!super.equals(obj))
    19
    return false;
    4
    return false;
    Precondition Violations (21)
    Row Violation
    1Type org.jfree.experimental.chart.util.XYCoordinateType of variable this.coordinateType does not match with type double of variable this.x1
    2Expression that.coordinateType cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression that.x1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Type org.jfree.experimental.chart.util.XYCoordinateType of variable that.coordinateType does not match with type double of variable that.x1
    5Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression that.y1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression that.x2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression that.maxWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression that.y2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Unmatched statement if(this.maxHeight != that.maxHeight) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12Unmatched return false;
    13Type org.jfree.chart.title.Title of variable this.title does not match with type java.awt.Paint of variable this.paint
    14Expression that.title cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Type org.jfree.chart.title.Title of variable that.title does not match with type java.awt.Paint of variable that.paint
    17Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.PaintUtilities
    18Expression this.anchor.equals(that.anchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19Super method call if(!super.equals(obj)) cannot be extracted from method
    20Clone fragment #1 returns variable that with type org.jfree.experimental.chart.annotations.XYTitleAnnotation , while Clone fragment #2 returns variable that with type org.jfree.chart.annotations.XYLineAnnotation
    21Not all possible execution flows end in a return statement