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 BarRenderer)) { return false; } if (!super.equals(obj)) { return false; } BarRenderer that = (BarRenderer) obj; if (this.base != that.base) { return false; } if (this.itemMargin != that.itemMargin) { return false; } if (this.drawBarOutline != that.drawBarOutline) { return false; } if (this.maximumBarWidth != that.maximumBarWidth) { return false; } if (this.minimumBarLength != that.minimumBarLength) { return false; } if (!ObjectUtilities.equal(this.gradientPaintTransformer, that.gradientPaintTransformer)) { return false; } if (!ObjectUtilities.equal(this.positiveItemLabelPositionFallback, that.positiveItemLabelPositionFallback)) { return false; } if (!ObjectUtilities.equal(this.negativeItemLabelPositionFallback, that.negativeItemLabelPositionFallback)) { 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/renderer/category/BarRenderer.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 BarRenderer)) {
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
        BarRenderer that = (BarRenderer) obj;
11
        if (!this.text.equals(that.text)) {
11
        if (this.base != that.base) {
12
            return false;   
12
            return false;
13
        }
13
        }
14
        if (this.x != that.x) {
14
        if (this.itemMargin != that.itemMargin) {
15
            return false;
15
            return false;
16
        }
16
        }
17
        if (this.y != that.y) {
17
        if (this.drawBarOutline != that.drawBarOutline) {
18
            return false;
18
            return false;
19
        }
19
        }
20
        if (!this.font.equals(that.font)) {
20
        if (this.maximumBarWidth != that.maximumBarWidth) {
21
            return false;   
21
            return false;
22
        }
22
        }
23
        if (!PaintUtilities.equal(this.paint, that.paint)) {
23
        if (this.minimumBarLength != that.minimumBarLength) {
24
            return false;   
24
            return false;
25
        }
25
        }
26
        if (!this.rotationAnchor.equals(that.rotationAncho
26
        if (!ObjectUtilities.equal(this.gradientPaintTransformer,
27
r)) {
27
                that.gradientPaintTransformer)) {
28
            return false;   
28
            return false;
29
        }
29
        }
30
        if (this.rotationAngle != that.rotationAngle
30
        if (!ObjectUtilities.equal(this.positiveItemLabelPositionFallback,
31
) {
31
            that.positiveItemLabelPositionFallback)) {
32
            return false;   
32
            return false;
33
        }
33
        }
34
        if (!this.textAnchor.equals(that.textAnchor
34
        if (!ObjectUtilities.equal(this.negativeItemLabelPositionFallback,
35
)) {
35
            that.negativeItemLabelPositionFallback)) {
36
            return false;   
36
            return false;
37
        }
37
        }
38
        return true;
38
        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)9.1
Clones locationClones are in different classes
Number of node comparisons206
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements19
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)11.4
    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 XYTextAnnotation))
    3
    if (!(obj instanceof XYTextAnnotation))
    3
    if (!(obj instanceof BarRenderer))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.renderer.category.BarRendererSUBCLASS_TYPE_MISMATCH
    3
    if (!(obj instanceof BarRenderer))
    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
    BarRenderer that = (BarRenderer)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.renderer.category.BarRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.renderer.category.BarRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.renderer.category.BarRendererSUBCLASS_TYPE_MISMATCH
    7
    BarRenderer that = (BarRenderer)obj;
                                                              
    8
    if (this.base != that.base)
    Preondition Violations
    Unmatched statement if(this.base != that.base) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    if (this.base != that.base)
                                    
    9
    return false;
    Preondition Violations
    Unmatched return false;
    9
    return false;
                                                                                                        
    12
    if (this.drawBarOutline != that.drawBarOutline)
    Preondition Violations
    Unmatched statement if(this.drawBarOutline != that.drawBarOutline) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12
    if (this.drawBarOutline != that.drawBarOutline)
                                      
    13
    return false;
    Preondition Violations
    Unmatched return false;
    13
    return false;
    8
    if (!this.text.equals(that.text))
    8
    if (!this.text.equals(that.text))
    18
    if (!ObjectUtilities.equal(this.gradientPaintTransformer, that.gradientPaintTransformer))
    Differences
    Expression1Expression2Difference
    this.text.equals(that.text)ObjectUtilities.equal(this.gradientPaintTransformer,that.gradientPaintTransformer)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.text.equals(that.text) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ObjectUtilities.equal(this.gradientPaintTransformer,that.gradientPaintTransformer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18
    if (!ObjectUtilities.equal(this.gradientPaintTransformer, that.gradientPaintTransformer))
    9
    return false;
    19
    return false;
    10
    if (this.x != that.x)
    10
    if (this.x != that.x)
    10
    if (this.itemMargin != that.itemMargin)
    Differences
    Expression1Expression2Difference
    xitemMarginVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.renderer.category.BarRendererSUBCLASS_TYPE_MISMATCH
    xitemMarginVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.itemMargin cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (this.itemMargin != that.itemMargin)
    11
    return false;
    11
    return false;
    12
    if (this.y != that.y)
    12
    if (this.y != that.y)
    14
    if (this.maximumBarWidth != that.maximumBarWidth)
    Differences
    Expression1Expression2Difference
    ymaximumBarWidthVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.renderer.category.BarRendererSUBCLASS_TYPE_MISMATCH
    ymaximumBarWidthVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.maximumBarWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14
    if (this.maximumBarWidth != that.maximumBarWidth)
    13
    return false;
    15
    return false;
    14
    if (!this.font.equals(that.font))
    14
    if (!this.font.equals(that.font))
    20
    if (!ObjectUtilities.equal(this.positiveItemLabelPositionFallback, that.positiveItemLabelPositionFallback))
    Differences
    Expression1Expression2Difference
    this.font.equals(that.font)ObjectUtilities.equal(this.positiveItemLabelPositionFallback,that.positiveItemLabelPositionFallback)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.font.equals(that.font) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ObjectUtilities.equal(this.positiveItemLabelPositionFallback,that.positiveItemLabelPositionFallback) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    20
    if (!ObjectUtilities.equal(this.positiveItemLabelPositionFallback, that.positiveItemLabelPositionFallback))
    15
    return false;
    21
    return false;
    16
    if (!PaintUtilities.equal(this.paint, that.paint))
    16
    if (!PaintUtilities.equal(this.paint, that.paint))
    22
    if (!ObjectUtilities.equal(this.negativeItemLabelPositionFallback, that.negativeItemLabelPositionFallback))
    Differences
    Expression1Expression2Difference
    paintnegativeItemLabelPositionFallbackVARIABLE_NAME_MISMATCH
    java.awt.Paintorg.jfree.chart.labels.ItemLabelPositionVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.renderer.category.BarRendererSUBCLASS_TYPE_MISMATCH
    paintnegativeItemLabelPositionFallbackVARIABLE_NAME_MISMATCH
    java.awt.Paintorg.jfree.chart.labels.ItemLabelPositionVARIABLE_TYPE_MISMATCH
    org.jfree.util.PaintUtilitiesorg.jfree.util.ObjectUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable this.paint does not match with type org.jfree.chart.labels.ItemLabelPosition of variable this.negativeItemLabelPositionFallback
    • Make classes java.awt.Paint and org.jfree.chart.labels.ItemLabelPosition extend a common superclass
    Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.negativeItemLabelPositionFallback cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Paint of variable that.paint does not match with type org.jfree.chart.labels.ItemLabelPosition of variable that.negativeItemLabelPositionFallback
    • Make classes java.awt.Paint and org.jfree.chart.labels.ItemLabelPosition extend a common superclass
    Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    • Make classes org.jfree.util.PaintUtilities and org.jfree.util.ObjectUtilities extend a common superclass
    22
    if (!ObjectUtilities.equal(this.negativeItemLabelPositionFallback, that.negativeItemLabelPositionFallback))
    17
    return false;
    23
    return false;
    18
    if (!this.rotationAnchor.equals(that.rotationAnchor))
    18
    if (!this.rotationAnchor.equals(that.rotationAnchor))
    Preondition Violations
    Unmatched statement if(!this.rotationAnchor.equals(that.rotationAnchor)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                    
    19
    return false;
    19
    return false;
    Preondition Violations
    Unmatched return false;
                                      
    20
    if (this.rotationAngle != that.rotationAngle)
    20
    if (this.rotationAngle != that.rotationAngle)
    16
    if (this.minimumBarLength != that.minimumBarLength)
    Differences
    Expression1Expression2Difference
    rotationAngleminimumBarLengthVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYTextAnnotationorg.jfree.chart.renderer.category.BarRendererSUBCLASS_TYPE_MISMATCH
    rotationAngleminimumBarLengthVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.rotationAngle cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.minimumBarLength cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16
    if (this.minimumBarLength != that.minimumBarLength)
    21
    return false;
    17
    return false;
    Precondition Violations (26)
    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
    3Unmatched statement if(this.base != that.base) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return false;
    5Unmatched statement if(this.drawBarOutline != that.drawBarOutline) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched return false;
    7Expression this.text.equals(that.text) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression ObjectUtilities.equal(this.gradientPaintTransformer,that.gradientPaintTransformer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression that.itemMargin cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression that.maximumBarWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression this.font.equals(that.font) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression ObjectUtilities.equal(this.positiveItemLabelPositionFallback,that.positiveItemLabelPositionFallback) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Type java.awt.Paint of variable this.paint does not match with type org.jfree.chart.labels.ItemLabelPosition of variable this.negativeItemLabelPositionFallback
    16Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression that.negativeItemLabelPositionFallback cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Type java.awt.Paint of variable that.paint does not match with type org.jfree.chart.labels.ItemLabelPosition of variable that.negativeItemLabelPositionFallback
    19Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    20Unmatched statement if(!this.rotationAnchor.equals(that.rotationAnchor)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    21Unmatched return false;
    22Expression that.rotationAngle cannot be parameterized, because it has dependencies to/from statements that will be extracted
    23Expression that.minimumBarLength cannot be parameterized, because it has dependencies to/from statements that will be extracted
    24Clone fragment #1 returns variable that with type org.jfree.chart.annotations.XYTextAnnotation , while Clone fragment #2 returns variable that with type org.jfree.chart.renderer.category.BarRenderer
    25Not all possible execution flows end in a return statement
    26The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYTextAnnotation and org.jfree.chart.renderer.category.BarRenderer do not have a common superclass