if (obj == this) { return true; } if (!(obj instanceof CategoryItemEntity)) { return false; } CategoryItemEntity that = (CategoryItemEntity) obj; if (!this.rowKey.equals(that.rowKey)) { return false; } if (!this.columnKey.equals(that.columnKey)) { return false; } if (!ObjectUtilities.equal(this.dataset, that.dataset)) { return false; } // check the deprecated fields if (this.categoryIndex != that.categoryIndex) { return false; } if (this.series != that.series) { return false; } if (!ObjectUtilities.equal(this.category, that.category)) { return false; } return super.equals(obj);
if (obj == this) { return true; } if (!(obj instanceof XYDifferenceRenderer)) { return false; } if (!super.equals(obj)) { return false; } XYDifferenceRenderer that = (XYDifferenceRenderer) obj; if (!PaintUtilities.equal(this.positivePaint, that.positivePaint)) { return false; } if (!PaintUtilities.equal(this.negativePaint, that.negativePaint)) { return false; } if (this.shapesVisible != that.shapesVisible) { return false; } if (!ShapeUtilities.equal(this.legendLine, that.legendLine)) { return false; } if (this.roundXCoordinates != that.roundXCoordinates) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/entity/CategoryItemEntity.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYDifferenceRenderer.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 18 Number of AST nodes: 18
1
if (obj == this) {
1
if (obj == this) {
2
            return true;      
2
            return true;   
3
        }
3
        }
4
        if (!(obj instanceof CategoryItemEntity)) {
4
        if (!(obj instanceof XYDifferenceRenderer)) {
5
            return false;
5
            return false;
6
        }
6
   
7
        CategoryItemEntity that = (CategoryItemEntity) obj;
7
        }
8
        if (!this.rowKey.equals(that.rowKey)) {
8
        if (!super.equals(obj)) {
9
            return false;
9
            return false;   
10
        }
10
        }
11
        if (!this.columnKey
11
        XYDifferenceRenderer that = (XYDifferenceRenderer) obj;
12
.equals(that.columnKey)) {
12
        if (!PaintUtilities.equal(this.positivePaint, that.positivePaint)) {
13
            return false;
13
            return false;   
14
        }
14
        }
15
        if (!ObjectUtilities.equal(this.dataset, that.dataset)) {
15
        if (!PaintUtilities.equal(this.negativePaint, that.negativePaint)) {
16
            return false;
16
            return false;   
17
        }
17
        }
18
        
18
        
19
        // check the deprecated fields
20
        if (this.categoryIndex != that.categoryIndex) {
19
if (this.shapesVisible != that.shapesVisible) {
21
            return false;   
20
            return false;   
22
        }
21
        }
23
        if (this.series != that.series) {
22
        if (!ShapeUtilities.equal(this.legendLine, that.legendLine)) {
24
            return false;   
23
            return false;   
25
        }
24
        }
26
        if (!ObjectUtilities.equal(this.category, that.category)) {
25
        if (this.roundXCoordinates != that.roundXCoordinates) {
27
            return false;   
26
            return false;
28
        }
27
        }
29
        return super.equals(obj);
28
        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)5.3
Clones locationClones are in different classes
Number of node comparisons125
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements17
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)8.4
    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 CategoryItemEntity))
    3
    if (!(obj instanceof CategoryItemEntity))
    3
    if (!(obj instanceof XYDifferenceRenderer))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.entity.CategoryItemEntityorg.jfree.chart.renderer.xy.XYDifferenceRendererSUBCLASS_TYPE_MISMATCH
    3
    if (!(obj instanceof XYDifferenceRenderer))
    4
    return false;
    4
    return false;
    5
    CategoryItemEntity that = (CategoryItemEntity)obj;
                                                                                                          
    6
    if (!this.rowKey.equals(that.rowKey))
    6
    if (!this.rowKey.equals(that.rowKey))
    5
    if (!super.equals(obj))
    Differences
    Expression1Expression2Difference
    this.rowKey.equals(that.rowKey)super.equals(obj)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.rowKey.equals(that.rowKey) 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
    5
    if (!super.equals(obj))
    7
    return false;
    6
    return false;
                                                                                                                  
    7
    XYDifferenceRenderer that = (XYDifferenceRenderer)obj;
    8
    if (!this.columnKey.equals(that.columnKey))
    8
    if (!this.columnKey.equals(that.columnKey))
    8
    if (!PaintUtilities.equal(this.positivePaint, that.positivePaint))
    Differences
    Expression1Expression2Difference
    this.columnKey.equals(that.columnKey)PaintUtilities.equal(this.positivePaint,that.positivePaint)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.columnKey.equals(that.columnKey) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression PaintUtilities.equal(this.positivePaint,that.positivePaint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (!PaintUtilities.equal(this.positivePaint, that.positivePaint))
    9
    return false;
    9
    return false;
    10
    if (!ObjectUtilities.equal(this.dataset, that.dataset))
    10
    if (!ObjectUtilities.equal(this.dataset, that.dataset))
    10
    if (!PaintUtilities.equal(this.negativePaint, that.negativePaint))
    Differences
    Expression1Expression2Difference
    datasetnegativePaintVARIABLE_NAME_MISMATCH
    org.jfree.data.category.CategoryDatasetjava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.chart.entity.CategoryItemEntityorg.jfree.chart.renderer.xy.XYDifferenceRendererSUBCLASS_TYPE_MISMATCH
    datasetnegativePaintVARIABLE_NAME_MISMATCH
    org.jfree.data.category.CategoryDatasetjava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.util.ObjectUtilitiesorg.jfree.util.PaintUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.data.category.CategoryDataset of variable this.dataset does not match with type java.awt.Paint of variable this.negativePaint
    • Make classes org.jfree.data.category.CategoryDataset and java.awt.Paint extend a common superclass
    Expression that.dataset cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.negativePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.data.category.CategoryDataset of variable that.dataset does not match with type java.awt.Paint of variable that.negativePaint
    • Make classes org.jfree.data.category.CategoryDataset 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
    10
    if (!PaintUtilities.equal(this.negativePaint, that.negativePaint))
    11
    return false;
    11
    return false;
    12
    if (this.categoryIndex != that.categoryIndex)
    12
    if (this.categoryIndex != that.categoryIndex)
    12
    if (this.shapesVisible != that.shapesVisible)
    Differences
    Expression1Expression2Difference
    categoryIndexshapesVisibleVARIABLE_NAME_MISMATCH
    intbooleanVARIABLE_TYPE_MISMATCH
    org.jfree.chart.entity.CategoryItemEntityorg.jfree.chart.renderer.xy.XYDifferenceRendererSUBCLASS_TYPE_MISMATCH
    categoryIndexshapesVisibleVARIABLE_NAME_MISMATCH
    intbooleanVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable this.categoryIndex does not match with type boolean of variable this.shapesVisible
    Expression that.categoryIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.shapesVisible cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type int of variable that.categoryIndex does not match with type boolean of variable that.shapesVisible
    12
    if (this.shapesVisible != that.shapesVisible)
    13
    return false;
    13
    return false;
    14
    if (this.series != that.series)
    14
    if (this.series != that.series)
    16
    if (this.roundXCoordinates != that.roundXCoordinates)
    Differences
    Expression1Expression2Difference
    seriesroundXCoordinatesVARIABLE_NAME_MISMATCH
    intbooleanVARIABLE_TYPE_MISMATCH
    org.jfree.chart.entity.CategoryItemEntityorg.jfree.chart.renderer.xy.XYDifferenceRendererSUBCLASS_TYPE_MISMATCH
    seriesroundXCoordinatesVARIABLE_NAME_MISMATCH
    intbooleanVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable this.series does not match with type boolean of variable this.roundXCoordinates
    Expression that.series cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.roundXCoordinates cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type int of variable that.series does not match with type boolean of variable that.roundXCoordinates
    16
    if (this.roundXCoordinates != that.roundXCoordinates)
    15
    return false;
    17
    return false;
    16
    if (!ObjectUtilities.equal(this.category, that.category))
    16
    if (!ObjectUtilities.equal(this.category, that.category))
    14
    if (!ShapeUtilities.equal(this.legendLine, that.legendLine))
    Differences
    Expression1Expression2Difference
    categorylegendLineVARIABLE_NAME_MISMATCH
    java.lang.Objectjava.awt.ShapeVARIABLE_TYPE_MISMATCH
    org.jfree.chart.entity.CategoryItemEntityorg.jfree.chart.renderer.xy.XYDifferenceRendererSUBCLASS_TYPE_MISMATCH
    categorylegendLineVARIABLE_NAME_MISMATCH
    java.lang.Objectjava.awt.ShapeVARIABLE_TYPE_MISMATCH
    org.jfree.util.ObjectUtilitiesorg.jfree.util.ShapeUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Object of variable this.category does not match with type java.awt.Shape of variable this.legendLine
    • Make classes java.lang.Object and java.awt.Shape extend a common superclass
    Expression that.category cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.legendLine cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.Object of variable that.category does not match with type java.awt.Shape of variable that.legendLine
    • Make classes java.lang.Object and java.awt.Shape extend a common superclass
    Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.ShapeUtilities
    • Make classes org.jfree.util.ObjectUtilities and org.jfree.util.ShapeUtilities extend a common superclass
    14
    if (!ShapeUtilities.equal(this.legendLine, that.legendLine))
    17
    return false;
    15
    return false;
    18
    return super.equals(obj);
    18
    return super.equals(obj);
    18
    return true;
    Differences
    Expression1Expression2Difference
    super.equals(obj)trueTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Super method call return super.equals(obj); cannot be extracted from method
    18
    return true;
    Precondition Violations (24)
    Row Violation
    1Expression this.rowKey.equals(that.rowKey) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Super method call if(!super.equals(obj)) cannot be extracted from method
    3Expression this.columnKey.equals(that.columnKey) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression PaintUtilities.equal(this.positivePaint,that.positivePaint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type org.jfree.data.category.CategoryDataset of variable this.dataset does not match with type java.awt.Paint of variable this.negativePaint
    6Expression that.dataset cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression that.negativePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Type org.jfree.data.category.CategoryDataset of variable that.dataset does not match with type java.awt.Paint of variable that.negativePaint
    9Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.PaintUtilities
    10Type int of variable this.categoryIndex does not match with type boolean of variable this.shapesVisible
    11Expression that.categoryIndex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression that.shapesVisible cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Type int of variable that.categoryIndex does not match with type boolean of variable that.shapesVisible
    14Type int of variable this.series does not match with type boolean of variable this.roundXCoordinates
    15Expression that.series cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Expression that.roundXCoordinates cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Type int of variable that.series does not match with type boolean of variable that.roundXCoordinates
    18Type java.lang.Object of variable this.category does not match with type java.awt.Shape of variable this.legendLine
    19Expression that.category cannot be parameterized, because it has dependencies to/from statements that will be extracted
    20Expression that.legendLine cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21Type java.lang.Object of variable that.category does not match with type java.awt.Shape of variable that.legendLine
    22Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.ShapeUtilities
    23Super method call return super.equals(obj); cannot be extracted from method
    24The refactoring of the clones is infeasible, because classes org.jfree.chart.entity.CategoryItemEntity and org.jfree.chart.renderer.xy.XYDifferenceRenderer do not have a common superclass