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;
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/renderer/category/BarRenderer.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 BarRenderer)) {
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
        BarRenderer that = (BarRenderer) obj;
10
        
11
        if (this.base != that.base
11
LegendTitle that = (LegendTitle) obj;
12
) {
12
        if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) {
13
            return false;
13
            return false;   
14
        }
14
        }
15
        if (this.itemMargin != that.itemMargin) {
15
        if (this.legendItemGraphicEdge != that.legendItemGraphicEdge) {
16
            return false;
16
            return false;   
17
        }
17
        }
18
        if (this.drawBarOutline != that.drawBarOutline) {
18
        if (this.legendItemGraphicAnchor != that.legendItemGraphicAnchor) {
19
            return false;
19
            return false;   
20
        }
20
        }
21
        if (this.maximumBarWidth != that.maximumBarWidth) {
21
        if (this.legendItemGraphicLocation != that.legendItemGraphicLocation) {
22
            return false;
22
            return false;   
23
        }
23
        }
24
        if (this.minimumBarLength != that.minimumBarLength) {
24
        if (!this.itemFont.equals(that.itemFont)) {
25
            return false;
25
            return false;   
26
        }
26
        }
27
        if (!ObjectUtilities.equal(this.gradientPaintTransformer,
27
        if (!
28
                that.gradientPaintTransformer)) {
28
this.itemPaint.equals(that.itemPaint)) {
29
            return false;
29
            return false;   
30
        }
30
        }
31
        if (!ObjectUtilities.equal(this.positiveItemLabelPositionFallback,
31
        if (!
32
            that.positiveItemLabelPositionFallback)) {
32
this.hLayout.equals(that.hLayout)) {
33
            return false;
33
            return false;   
34
        }
34
        }
35
        if (!ObjectUtilities.equal(this.negativeItemLabelPositionFallback,
35
        if (!
36
            that.negativeItemLabelPositionFallback)) {
36
this.vLayout.equals(that.vLayout)) {
37
            return false;
37
            return false;   
38
        }
38
        }
39
        return true;
39
        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)10.2
Clones locationClones are in different classes
Number of node comparisons188
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements19
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)10.2
    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 BarRenderer))
    3
    if (!(obj instanceof BarRenderer))
    3
    if (!(obj instanceof LegendTitle))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.renderer.category.BarRendererorg.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
    BarRenderer that = (BarRenderer)obj;
    7
    BarRenderer that = (BarRenderer)obj;
    7
    LegendTitle that = (LegendTitle)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.renderer.category.BarRendererorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.renderer.category.BarRendererorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.renderer.category.BarRendererorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    7
    LegendTitle that = (LegendTitle)obj;
    8
    if (this.base != that.base)
    8
    if (this.base != that.base)
    10
    if (this.legendItemGraphicEdge != that.legendItemGraphicEdge)
    Differences
    Expression1Expression2Difference
    baselegendItemGraphicEdgeVARIABLE_NAME_MISMATCH
    doubleorg.jfree.ui.RectangleEdgeVARIABLE_TYPE_MISMATCH
    org.jfree.chart.renderer.category.BarRendererorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    baselegendItemGraphicEdgeVARIABLE_NAME_MISMATCH
    doubleorg.jfree.ui.RectangleEdgeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double of variable this.base does not match with type org.jfree.ui.RectangleEdge of variable this.legendItemGraphicEdge
    Expression that.base 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.base does not match with type org.jfree.ui.RectangleEdge of variable that.legendItemGraphicEdge
    10
    if (this.legendItemGraphicEdge != that.legendItemGraphicEdge)
    9
    return false;
    11
    return false;
    10
    if (this.itemMargin != that.itemMargin)
    10
    if (this.itemMargin != that.itemMargin)
    12
    if (this.legendItemGraphicAnchor != that.legendItemGraphicAnchor)
    Differences
    Expression1Expression2Difference
    itemMarginlegendItemGraphicAnchorVARIABLE_NAME_MISMATCH
    doubleorg.jfree.ui.RectangleAnchorVARIABLE_TYPE_MISMATCH
    org.jfree.chart.renderer.category.BarRendererorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    itemMarginlegendItemGraphicAnchorVARIABLE_NAME_MISMATCH
    doubleorg.jfree.ui.RectangleAnchorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double of variable this.itemMargin does not match with type org.jfree.ui.RectangleAnchor of variable this.legendItemGraphicAnchor
    Expression that.itemMargin 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.itemMargin does not match with type org.jfree.ui.RectangleAnchor of variable that.legendItemGraphicAnchor
    12
    if (this.legendItemGraphicAnchor != that.legendItemGraphicAnchor)
    11
    return false;
    13
    return false;
    12
    if (this.drawBarOutline != that.drawBarOutline)
    12
    if (this.drawBarOutline != that.drawBarOutline)
    14
    if (this.legendItemGraphicLocation != that.legendItemGraphicLocation)
    Differences
    Expression1Expression2Difference
    drawBarOutlinelegendItemGraphicLocationVARIABLE_NAME_MISMATCH
    booleanorg.jfree.ui.RectangleAnchorVARIABLE_TYPE_MISMATCH
    org.jfree.chart.renderer.category.BarRendererorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    drawBarOutlinelegendItemGraphicLocationVARIABLE_NAME_MISMATCH
    booleanorg.jfree.ui.RectangleAnchorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type boolean of variable this.drawBarOutline does not match with type org.jfree.ui.RectangleAnchor of variable this.legendItemGraphicLocation
    Expression that.drawBarOutline 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 boolean of variable that.drawBarOutline does not match with type org.jfree.ui.RectangleAnchor of variable that.legendItemGraphicLocation
    14
    if (this.legendItemGraphicLocation != that.legendItemGraphicLocation)
    13
    return false;
    15
    return false;
    14
    if (this.maximumBarWidth != that.maximumBarWidth)
    14
    if (this.maximumBarWidth != that.maximumBarWidth)
    Preondition Violations
    Unmatched statement if(this.maximumBarWidth != that.maximumBarWidth) 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 (this.minimumBarLength != that.minimumBarLength)
    16
    if (this.minimumBarLength != that.minimumBarLength)
    Preondition Violations
    Unmatched statement if(this.minimumBarLength != that.minimumBarLength) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                
    17
    return false;
    17
    return false;
    Preondition Violations
    Unmatched return false;
                                      
    18
    if (!ObjectUtilities.equal(this.gradientPaintTransformer, that.gradientPaintTransformer))
    18
    if (!ObjectUtilities.equal(this.gradientPaintTransformer, that.gradientPaintTransformer))
    8
    if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint))
    Differences
    Expression1Expression2Difference
    gradientPaintTransformerbackgroundPaintVARIABLE_NAME_MISMATCH
    org.jfree.ui.GradientPaintTransformerjava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.chart.renderer.category.BarRendererorg.jfree.chart.title.LegendTitleSUBCLASS_TYPE_MISMATCH
    gradientPaintTransformerbackgroundPaintVARIABLE_NAME_MISMATCH
    org.jfree.ui.GradientPaintTransformerjava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.util.ObjectUtilitiesorg.jfree.util.PaintUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.ui.GradientPaintTransformer of variable this.gradientPaintTransformer does not match with type java.awt.Paint of variable this.backgroundPaint
    • Make classes org.jfree.ui.GradientPaintTransformer and java.awt.Paint extend a common superclass
    Expression that.gradientPaintTransformer 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
    Type org.jfree.ui.GradientPaintTransformer of variable that.gradientPaintTransformer does not match with type java.awt.Paint of variable that.backgroundPaint
    • Make classes org.jfree.ui.GradientPaintTransformer 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
    8
    if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint))
    19
    return false;
    9
    return false;
    20
    if (!ObjectUtilities.equal(this.positiveItemLabelPositionFallback, that.positiveItemLabelPositionFallback))
    20
    if (!ObjectUtilities.equal(this.positiveItemLabelPositionFallback, that.positiveItemLabelPositionFallback))
    18
    if (!this.itemPaint.equals(that.itemPaint))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.positiveItemLabelPositionFallback,that.positiveItemLabelPositionFallback)this.itemPaint.equals(that.itemPaint)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.positiveItemLabelPositionFallback,that.positiveItemLabelPositionFallback) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.itemPaint.equals(that.itemPaint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18
    if (!this.itemPaint.equals(that.itemPaint))
    21
    return false;
    19
    return false;
    22
    if (!ObjectUtilities.equal(this.negativeItemLabelPositionFallback, that.negativeItemLabelPositionFallback))
    22
    if (!ObjectUtilities.equal(this.negativeItemLabelPositionFallback, that.negativeItemLabelPositionFallback))
    16
    if (!this.itemFont.equals(that.itemFont))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.negativeItemLabelPositionFallback,that.negativeItemLabelPositionFallback)this.itemFont.equals(that.itemFont)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.negativeItemLabelPositionFallback,that.negativeItemLabelPositionFallback) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.itemFont.equals(that.itemFont) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16
    if (!this.itemFont.equals(that.itemFont))
    23
    return false;
    17
    return false;
    Precondition Violations (30)
    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
    3Type double of variable this.base does not match with type org.jfree.ui.RectangleEdge of variable this.legendItemGraphicEdge
    4Expression that.base cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.legendItemGraphicEdge cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type double of variable that.base does not match with type org.jfree.ui.RectangleEdge of variable that.legendItemGraphicEdge
    7Type double of variable this.itemMargin does not match with type org.jfree.ui.RectangleAnchor of variable this.legendItemGraphicAnchor
    8Expression that.itemMargin cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression that.legendItemGraphicAnchor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Type double of variable that.itemMargin does not match with type org.jfree.ui.RectangleAnchor of variable that.legendItemGraphicAnchor
    11Type boolean of variable this.drawBarOutline does not match with type org.jfree.ui.RectangleAnchor of variable this.legendItemGraphicLocation
    12Expression that.drawBarOutline cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression that.legendItemGraphicLocation cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Type boolean of variable that.drawBarOutline does not match with type org.jfree.ui.RectangleAnchor of variable that.legendItemGraphicLocation
    15Unmatched statement if(this.maximumBarWidth != that.maximumBarWidth) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    16Unmatched return false;
    17Unmatched statement if(this.minimumBarLength != that.minimumBarLength) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    18Unmatched return false;
    19Type org.jfree.ui.GradientPaintTransformer of variable this.gradientPaintTransformer does not match with type java.awt.Paint of variable this.backgroundPaint
    20Expression that.gradientPaintTransformer 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
    22Type org.jfree.ui.GradientPaintTransformer of variable that.gradientPaintTransformer does not match with type java.awt.Paint of variable that.backgroundPaint
    23Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.PaintUtilities
    24Expression ObjectUtilities.equal(this.positiveItemLabelPositionFallback,that.positiveItemLabelPositionFallback) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    25Expression this.itemPaint.equals(that.itemPaint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    26Expression ObjectUtilities.equal(this.negativeItemLabelPositionFallback,that.negativeItemLabelPositionFallback) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    27Expression this.itemFont.equals(that.itemFont) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    28Clone fragment #1 returns variable that with type org.jfree.chart.renderer.category.BarRenderer , while Clone fragment #2 returns variable that with type org.jfree.chart.title.LegendTitle
    29Not all possible execution flows end in a return statement
    30The refactoring of the clones is infeasible, because classes org.jfree.chart.renderer.category.BarRenderer and org.jfree.chart.title.LegendTitle do not have a common superclass