if (obj == this) { return true; } if (!(obj instanceof LegendItemEntity)) { return false; } LegendItemEntity that = (LegendItemEntity) obj; if (!ObjectUtilities.equal(this.seriesKey, that.seriesKey)) { return false; } if (this.seriesIndex != that.seriesIndex) { return false; } if (!ObjectUtilities.equal(this.dataset, that.dataset)) { return false; } return super.equals(obj);
if (obj == this) { return true; } if (!(obj instanceof MinMaxCategoryRenderer)) { return false; } MinMaxCategoryRenderer that = (MinMaxCategoryRenderer) obj; if (this.plotLines != that.plotLines) { return false; } if (!PaintUtilities.equal(this.groupPaint, that.groupPaint)) { return false; } if (!this.groupStroke.equals(that.groupStroke)) { return false; } return super.equals(obj);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/entity/LegendItemEntity.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/MinMaxCategoryRenderer.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 12 Number of AST nodes: 12
1
if (obj == this) {
1
if (obj == this) {
2
            return true;   
2
            return true;
3
        }
3
        }
4
        if (!(obj instanceof LegendItemEntity)) {
4
        if (!(obj instanceof MinMaxCategoryRenderer)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        LegendItemEntity that = (LegendItemEntity) obj;
7
        
8
        if (!ObjectUtilities.equal(this.seriesKey, that.seriesKey)
8
MinMaxCategoryRenderer that = (MinMaxCategoryRenderer) obj;
9
) {
9
        if (this.plotLines != that.plotLines) {
10
            return false;
10
            return false;
11
        }
11
        }
12
        if (this.seriesIndex != that.seriesIndex) {
12
        if (!PaintUtilities.equal(this.groupPaint, that.groupPaint)) {
13
            return false;   
13
            return false;
14
        }
14
        }
15
        if (!ObjectUtilities.equal(this.dataset, that.dataset)) {
15
        if (!this.groupStroke.equals(that.groupStroke)) {
16
            return false;
16
            return false;
17
        }
17
        }
18
        return super.equals(obj);
18
        return super.equals(obj);
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)2.0
Clones locationClones are in different classes
Number of node comparisons53
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.6
    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 LegendItemEntity))
    3
    if (!(obj instanceof LegendItemEntity))
    3
    if (!(obj instanceof MinMaxCategoryRenderer))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.entity.LegendItemEntityorg.jfree.chart.renderer.category.MinMaxCategoryRendererSUBCLASS_TYPE_MISMATCH
    3
    if (!(obj instanceof MinMaxCategoryRenderer))
    4
    return false;
    4
    return false;
    5
    LegendItemEntity that = (LegendItemEntity)obj;
    5
    LegendItemEntity that = (LegendItemEntity)obj;
    5
    MinMaxCategoryRenderer that = (MinMaxCategoryRenderer)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.entity.LegendItemEntityorg.jfree.chart.renderer.category.MinMaxCategoryRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.entity.LegendItemEntityorg.jfree.chart.renderer.category.MinMaxCategoryRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.entity.LegendItemEntityorg.jfree.chart.renderer.category.MinMaxCategoryRendererSUBCLASS_TYPE_MISMATCH
    5
    MinMaxCategoryRenderer that = (MinMaxCategoryRenderer)obj;
    6
    if (!ObjectUtilities.equal(this.seriesKey, that.seriesKey))
    6
    if (!ObjectUtilities.equal(this.seriesKey, that.seriesKey))
    8
    if (!PaintUtilities.equal(this.groupPaint, that.groupPaint))
    Differences
    Expression1Expression2Difference
    seriesKeygroupPaintVARIABLE_NAME_MISMATCH
    java.lang.Comparablejava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.chart.entity.LegendItemEntityorg.jfree.chart.renderer.category.MinMaxCategoryRendererSUBCLASS_TYPE_MISMATCH
    seriesKeygroupPaintVARIABLE_NAME_MISMATCH
    java.lang.Comparablejava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.util.ObjectUtilitiesorg.jfree.util.PaintUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Comparable of variable this.seriesKey does not match with type java.awt.Paint of variable this.groupPaint
    • Make classes java.lang.Comparable and java.awt.Paint extend a common superclass
    Expression that.seriesKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.groupPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.Comparable of variable that.seriesKey does not match with type java.awt.Paint of variable that.groupPaint
    • Make classes java.lang.Comparable 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.groupPaint, that.groupPaint))
    7
    return false;
    9
    return false;
    8
    if (this.seriesIndex != that.seriesIndex)
    8
    if (this.seriesIndex != that.seriesIndex)
    6
    if (this.plotLines != that.plotLines)
    Differences
    Expression1Expression2Difference
    seriesIndexplotLinesVARIABLE_NAME_MISMATCH
    intbooleanVARIABLE_TYPE_MISMATCH
    org.jfree.chart.entity.LegendItemEntityorg.jfree.chart.renderer.category.MinMaxCategoryRendererSUBCLASS_TYPE_MISMATCH
    seriesIndexplotLinesVARIABLE_NAME_MISMATCH
    intbooleanVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable this.seriesIndex does not match with type boolean of variable this.plotLines
    Expression that.seriesIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.plotLines cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type int of variable that.seriesIndex does not match with type boolean of variable that.plotLines
    6
    if (this.plotLines != that.plotLines)
    9
    return false;
    7
    return false;
    10
    if (!ObjectUtilities.equal(this.dataset, that.dataset))
    10
    if (!ObjectUtilities.equal(this.dataset, that.dataset))
    10
    if (!this.groupStroke.equals(that.groupStroke))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.dataset,that.dataset)this.groupStroke.equals(that.groupStroke)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.dataset,that.dataset) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.groupStroke.equals(that.groupStroke) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (!this.groupStroke.equals(that.groupStroke))
    11
    return false;
    11
    return false;
    12
    return super.equals(obj);
    12
    return super.equals(obj);
    12
    return super.equals(obj);
    Preondition Violations
    Super method call return super.equals(obj); cannot be extracted from method
    Super method call return super.equals(obj); cannot be extracted from method
    12
    return super.equals(obj);
    Precondition Violations (14)
    Row Violation
    1Type java.lang.Comparable of variable this.seriesKey does not match with type java.awt.Paint of variable this.groupPaint
    2Expression that.seriesKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression that.groupPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Type java.lang.Comparable of variable that.seriesKey does not match with type java.awt.Paint of variable that.groupPaint
    5Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.PaintUtilities
    6Type int of variable this.seriesIndex does not match with type boolean of variable this.plotLines
    7Expression that.seriesIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression that.plotLines cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type int of variable that.seriesIndex does not match with type boolean of variable that.plotLines
    10Expression ObjectUtilities.equal(this.dataset,that.dataset) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression this.groupStroke.equals(that.groupStroke) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Super method call return super.equals(obj); cannot be extracted from method
    13Super method call return super.equals(obj); cannot be extracted from method
    14The refactoring of the clones is infeasible, because classes org.jfree.chart.entity.LegendItemEntity and org.jfree.chart.renderer.category.MinMaxCategoryRenderer do not have a common superclass