if (obj == this) { return true; } if (!(obj instanceof XYTextAnnotation)) { return false; } if (!super.equals(obj)) { return false; } XYTextAnnotation that = (XYTextAnnotation) obj; if (!this.text.equals(that.text)) { return false; } if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (!this.font.equals(that.font)) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!this.rotationAnchor.equals(that.rotationAnchor)) { return false; } if (this.rotationAngle != that.rotationAngle) { return false; } if (!this.textAnchor.equals(that.textAnchor)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof LegendTitle)) { return false; } if (!super.equals(obj)) { return false; } LegendTitle that = (LegendTitle) obj; if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) { return false; } if (this.legendItemGraphicEdge != that.legendItemGraphicEdge) { return false; } if (this.legendItemGraphicAnchor != that.legendItemGraphicAnchor) { return false; } if (this.legendItemGraphicLocation != that.legendItemGraphicLocation) { return false; } if (!this.itemFont.equals(that.itemFont)) { return false; } if (!this.itemPaint.equals(that.itemPaint)) { return false; } if (!this.hLayout.equals(that.hLayout)) { return false; } if (!this.vLayout.equals(that.vLayout)) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYTextAnnotation.java File path: /jfreechart-1.0.10/src/org/jfree/chart/title/LegendTitle.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 24 Number of AST nodes: 24
1
if (obj == this) {
1
if (obj == this) {
2
            return true;   
2
            return true;   
3
        }
3
        }
4
        if (!(obj instanceof XYTextAnnotation)) {
4
        if (!(obj instanceof LegendTitle)) {
5
            return false;   
5
            return false;   
6
        }
6
        }
7
        if (!super.equals(obj)) {
7
        if (!super.equals(obj)) {
8
            return false;
8
            return false;   
9
        }
9
        }
10
        XYTextAnnotation that = (XYTextAnnotation) obj;
10
        LegendTitle that = (LegendTitle) obj;
11
        if (!this.text.equals(that.text)) {
11
        if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) {
12
            return false;   
12
            return false;   
13
        }
13
        }
14
        if (this.x != that.x) {
14
        if (this.legendItemGraphicEdge != that.legendItemGraphicEdge) {
15
            return false;
15
            return false;   
16
        }
16
        }
17
        if (this.y != that.y) {
17
        if (this.legendItemGraphicAnchor != that.legendItemGraphicAnchor) {
18
            return false;
18
            return false;   
19
        }
19
        }
20
        if (!this.font.equals(that.font)) {
20
        if (this.legendItemGraphicLocation != that.legendItemGraphicLocation) {
21
            return false;   
21
            return false;   
22
        }
22
        }
23
        if (!PaintUtilities.equal(this.paint, that.paint)) {
23
        if (!this.itemFont.equals(that.itemFont)) {
24
            return false;   
24
            return false;   
25
        }
25
        }
26
        if (!this.rotationAnchor.equals(that.rotationAnchor)) {
26
        if (!this.itemPaint.equals(that.itemPaint)) {
27
            return false;   
27
            return false;   
28
        }
28
        }
29
        if (this.rotationAngle != that.rotationAngle) {
29
        if (!this.hLayout.equals(that.hLayout)) {
30
            return false;   
30
            return false;   
31
        }
31
        }
32
        if (!this.textAnchor.equals(that.textAnchor)) {
32
        if (!this.vLayout.equals(that.vLayout)) {
33
            return false;   
33
            return false;   
34
        }
34
        }
35
        return true;
35
        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)11.2
Clones locationClones are in different classes
Number of node comparisons230
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements24
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)12.2
    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 (!(obj instanceof XYTextAnnotation))
    3
    if (!(obj instanceof XYTextAnnotation))
    3
    if (!(obj instanceof LegendTitle))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    3
    if (!(obj instanceof LegendTitle))
    4
    return false;
    4
    return false;
    5
    if (!super.equals(obj))
    5
    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))
    6
    return false;
    6
    return false;
    7
    XYTextAnnotation that = (XYTextAnnotation)obj;
    7
    XYTextAnnotation that = (XYTextAnnotation)obj;
    7
    LegendTitle that = (LegendTitle)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    7
    LegendTitle that = (LegendTitle)obj;
    8
    if (!this.text.equals(that.text))
    8
    if (!this.text.equals(that.text))
    16
    if (!this.itemFont.equals(that.itemFont))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    textitemFontVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.awt.FontVARIABLE_TYPE_MISMATCH
    textitemFontVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.awt.FontVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression that.text cannot be unified with expression that.itemFont , because common superclass type java.io.Serializable cannot be passed as an argument to public boolean equals(java.lang.Object)
    Expression that.text cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.itemFont cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.String of variable that.text does not match with type java.awt.Font of variable that.itemFont
    • Make classes java.lang.String and java.awt.Font extend a common superclass
    Type java.lang.String of variable this.text does not match with type java.awt.Font of variable this.itemFont
    • Make classes java.lang.String and java.awt.Font extend a common superclass
    16
    if (!this.itemFont.equals(that.itemFont))
    9
    return false;
    17
    return false;
    10
    if (this.x != that.x)
    10
    if (this.x != that.x)
    10
    if (this.legendItemGraphicEdge != that.legendItemGraphicEdge)
    Differences
    Expression1Expression2Difference
    xlegendItemGraphicEdgeVARIABLE_NAME_MISMATCH
    doubleorg.jfree.ui.RectangleEdgeVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    xlegendItemGraphicEdgeVARIABLE_NAME_MISMATCH
    doubleorg.jfree.ui.RectangleEdgeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double of variable this.x does not match with type org.jfree.ui.RectangleEdge of variable this.legendItemGraphicEdge
    Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.legendItemGraphicEdge cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type double of variable that.x does not match with type org.jfree.ui.RectangleEdge of variable that.legendItemGraphicEdge
    10
    if (this.legendItemGraphicEdge != that.legendItemGraphicEdge)
    11
    return false;
    11
    return false;
    12
    if (this.y != that.y)
    12
    if (this.y != that.y)
    12
    if (this.legendItemGraphicAnchor != that.legendItemGraphicAnchor)
    Differences
    Expression1Expression2Difference
    ylegendItemGraphicAnchorVARIABLE_NAME_MISMATCH
    doubleorg.jfree.ui.RectangleAnchorVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    ylegendItemGraphicAnchorVARIABLE_NAME_MISMATCH
    doubleorg.jfree.ui.RectangleAnchorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double of variable this.y does not match with type org.jfree.ui.RectangleAnchor of variable this.legendItemGraphicAnchor
    Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.legendItemGraphicAnchor 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.ui.RectangleAnchor of variable that.legendItemGraphicAnchor
    12
    if (this.legendItemGraphicAnchor != that.legendItemGraphicAnchor)
    13
    return false;
    13
    return false;
    14
    if (!this.font.equals(that.font))
    14
    if (!this.font.equals(that.font))
    18
    if (!this.itemPaint.equals(that.itemPaint))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    fontitemPaintVARIABLE_NAME_MISMATCH
    java.awt.Fontjava.awt.PaintVARIABLE_TYPE_MISMATCH
    fontitemPaintVARIABLE_NAME_MISMATCH
    java.awt.Fontjava.awt.PaintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression that.font cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.itemPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Font of variable that.font does not match with type java.awt.Paint of variable that.itemPaint
    • Make classes java.awt.Font and java.awt.Paint extend a common superclass
    Type java.awt.Font of variable this.font does not match with type java.awt.Paint of variable this.itemPaint
    • Make classes java.awt.Font and java.awt.Paint extend a common superclass
    18
    if (!this.itemPaint.equals(that.itemPaint))
    15
    return false;
    19
    return false;
    16
    if (!PaintUtilities.equal(this.paint, that.paint))
    16
    if (!PaintUtilities.equal(this.paint, that.paint))
    8
    if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint))
    Differences
    Expression1Expression2Difference
    paintbackgroundPaintVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    paintbackgroundPaintVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.backgroundPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint))
    17
    return false;
    9
    return false;
    18
    if (!this.rotationAnchor.equals(that.rotationAnchor))
    18
    if (!this.rotationAnchor.equals(that.rotationAnchor))
    20
    if (!this.hLayout.equals(that.hLayout))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    rotationAnchorhLayoutVARIABLE_NAME_MISMATCH
    org.jfree.ui.TextAnchororg.jfree.chart.block.ArrangementVARIABLE_TYPE_MISMATCH
    rotationAnchorhLayoutVARIABLE_NAME_MISMATCH
    org.jfree.ui.TextAnchororg.jfree.chart.block.ArrangementVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression that.rotationAnchor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.hLayout cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.ui.TextAnchor of variable that.rotationAnchor does not match with type org.jfree.chart.block.Arrangement of variable that.hLayout
    • Make classes org.jfree.ui.TextAnchor and org.jfree.chart.block.Arrangement extend a common superclass
    Type org.jfree.ui.TextAnchor of variable this.rotationAnchor does not match with type org.jfree.chart.block.Arrangement of variable this.hLayout
    • Make classes org.jfree.ui.TextAnchor and org.jfree.chart.block.Arrangement extend a common superclass
    20
    if (!this.hLayout.equals(that.hLayout))
    19
    return false;
    21
    return false;
    20
    if (this.rotationAngle != that.rotationAngle)
    20
    if (this.rotationAngle != that.rotationAngle)
    14
    if (this.legendItemGraphicLocation != that.legendItemGraphicLocation)
    Differences
    Expression1Expression2Difference
    rotationAnglelegendItemGraphicLocationVARIABLE_NAME_MISMATCH
    doubleorg.jfree.ui.RectangleAnchorVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    rotationAnglelegendItemGraphicLocationVARIABLE_NAME_MISMATCH
    doubleorg.jfree.ui.RectangleAnchorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double of variable this.rotationAngle does not match with type org.jfree.ui.RectangleAnchor of variable this.legendItemGraphicLocation
    Expression that.rotationAngle cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.legendItemGraphicLocation cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type double of variable that.rotationAngle does not match with type org.jfree.ui.RectangleAnchor of variable that.legendItemGraphicLocation
    14
    if (this.legendItemGraphicLocation != that.legendItemGraphicLocation)
    21
    return false;
    15
    return false;
    22
    if (!this.textAnchor.equals(that.textAnchor))
    22
    if (!this.textAnchor.equals(that.textAnchor))
    22
    if (!this.vLayout.equals(that.vLayout))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    textAnchorvLayoutVARIABLE_NAME_MISMATCH
    org.jfree.ui.TextAnchororg.jfree.chart.block.ArrangementVARIABLE_TYPE_MISMATCH
    textAnchorvLayoutVARIABLE_NAME_MISMATCH
    org.jfree.ui.TextAnchororg.jfree.chart.block.ArrangementVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression that.textAnchor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.vLayout cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.ui.TextAnchor of variable that.textAnchor does not match with type org.jfree.chart.block.Arrangement of variable that.vLayout
    • Make classes org.jfree.ui.TextAnchor and org.jfree.chart.block.Arrangement extend a common superclass
    Type org.jfree.ui.TextAnchor of variable this.textAnchor does not match with type org.jfree.chart.block.Arrangement of variable this.vLayout
    • Make classes org.jfree.ui.TextAnchor and org.jfree.chart.block.Arrangement extend a common superclass
    22
    if (!this.vLayout.equals(that.vLayout))
    23
    return false;
    23
    return false;
    24
    return true;
    24
    return true;
    Precondition Violations (34)
    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
    3Expression that.text cannot be unified with expression that.itemFont , because common superclass type java.io.Serializable cannot be passed as an argument to public boolean equals(java.lang.Object)
    4Expression that.text cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.itemFont cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type java.lang.String of variable that.text does not match with type java.awt.Font of variable that.itemFont
    7Type java.lang.String of variable this.text does not match with type java.awt.Font of variable this.itemFont
    8Type double of variable this.x does not match with type org.jfree.ui.RectangleEdge of variable this.legendItemGraphicEdge
    9Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression that.legendItemGraphicEdge cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Type double of variable that.x does not match with type org.jfree.ui.RectangleEdge of variable that.legendItemGraphicEdge
    12Type double of variable this.y does not match with type org.jfree.ui.RectangleAnchor of variable this.legendItemGraphicAnchor
    13Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression that.legendItemGraphicAnchor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Type double of variable that.y does not match with type org.jfree.ui.RectangleAnchor of variable that.legendItemGraphicAnchor
    16Expression that.font cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression that.itemPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Type java.awt.Font of variable that.font does not match with type java.awt.Paint of variable that.itemPaint
    19Type java.awt.Font of variable this.font does not match with type java.awt.Paint of variable this.itemPaint
    20Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21Expression that.backgroundPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22Expression that.rotationAnchor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    23Expression that.hLayout cannot be parameterized, because it has dependencies to/from statements that will be extracted
    24Type org.jfree.ui.TextAnchor of variable that.rotationAnchor does not match with type org.jfree.chart.block.Arrangement of variable that.hLayout
    25Type org.jfree.ui.TextAnchor of variable this.rotationAnchor does not match with type org.jfree.chart.block.Arrangement of variable this.hLayout
    26Type double of variable this.rotationAngle does not match with type org.jfree.ui.RectangleAnchor of variable this.legendItemGraphicLocation
    27Expression that.rotationAngle cannot be parameterized, because it has dependencies to/from statements that will be extracted
    28Expression that.legendItemGraphicLocation cannot be parameterized, because it has dependencies to/from statements that will be extracted
    29Type double of variable that.rotationAngle does not match with type org.jfree.ui.RectangleAnchor of variable that.legendItemGraphicLocation
    30Expression that.textAnchor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    31Expression that.vLayout cannot be parameterized, because it has dependencies to/from statements that will be extracted
    32Type org.jfree.ui.TextAnchor of variable that.textAnchor does not match with type org.jfree.chart.block.Arrangement of variable that.vLayout
    33Type org.jfree.ui.TextAnchor of variable this.textAnchor does not match with type org.jfree.chart.block.Arrangement of variable this.vLayout
    34The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYTextAnnotation and org.jfree.chart.title.LegendTitle do not have a common superclass