if (obj == this) { return true; } if (!(obj instanceof BorderArrangement)) { return false; } BorderArrangement that = (BorderArrangement) obj; if (!ObjectUtilities.equal(this.topBlock, that.topBlock)) { return false; } if (!ObjectUtilities.equal(this.bottomBlock, that.bottomBlock)) { return false; } if (!ObjectUtilities.equal(this.leftBlock, that.leftBlock)) { return false; } if (!ObjectUtilities.equal(this.rightBlock, that.rightBlock)) { return false; } if (!ObjectUtilities.equal(this.centerBlock, that.centerBlock)) { return false; } return true;
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);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/block/BorderArrangement.java File path: /jfreechart-1.0.10/src/org/jfree/chart/entity/CategoryItemEntity.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 16 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 BorderArrangement)) {
4
        if (!(obj instanceof CategoryItemEntity)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        BorderArrangement that = (BorderArrangement) obj;
7
        CategoryItemEntity that = (CategoryItemEntity) obj;
8
        if (!ObjectUtilities.equal(this.topBlock, that.topBlock)) {
8
        if (!this.rowKey.equals(that.rowKey)) {
9
            return false;
9
            return false;
10
        }
10
        }
11
        if (!ObjectUtilities.equal(this.bottomBlock, that.bottomBlock)) {
11
        if (!this.columnKey.equals(that.columnKey)) {
12
            return false;
12
            return false;
13
        }
13
        }
14
        if (!ObjectUtilities.equal(this.leftBlock, that.leftBlock)) {
14
        if (!ObjectUtilities.equal(this.dataset, that.dataset)) {
15
            return false;
15
            return false;
16
        }
16
        }
17
        if (!ObjectUtilities.equal(this.rightBlock, that.rightBlock)
17
        
18
        // check the deprecated fields
19
        if (this.categoryIndex != that.categoryIndex) {
20
            return false;   
21
        }
18
) {
22
        if (this.series != that.series) {
19
            return false;
23
            return false;   
20
        }
24
        }
21
        if (!ObjectUtilities.equal(this.centerBlock, that.centerBlock)) {
25
        if (!ObjectUtilities.equal(this.category, that.category)) {
22
            return false;
26
            return false;   
23
        }
27
        }
24
        return true;
28
        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)4.2
Clones locationClones are in different classes
Number of node comparisons105
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)4.5
    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 BorderArrangement))
    3
    if (!(obj instanceof BorderArrangement))
    3
    if (!(obj instanceof CategoryItemEntity))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.block.BorderArrangementorg.jfree.chart.entity.CategoryItemEntityVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.block.BorderArrangement does not match with type org.jfree.chart.entity.CategoryItemEntity
    • Make classes org.jfree.chart.block.BorderArrangement and org.jfree.chart.entity.CategoryItemEntity extend a common superclass
    3
    if (!(obj instanceof CategoryItemEntity))
    4
    return false;
    4
    return false;
                                                                                                          
    5
    CategoryItemEntity that = (CategoryItemEntity)obj;
    5
    BorderArrangement that = (BorderArrangement)obj;
                                                                                                      
    6
    if (!ObjectUtilities.equal(this.topBlock, that.topBlock))
    6
    if (!ObjectUtilities.equal(this.topBlock, that.topBlock))
    10
    if (!ObjectUtilities.equal(this.dataset, that.dataset))
    Differences
    Expression1Expression2Difference
    topBlockdatasetVARIABLE_NAME_MISMATCH
    org.jfree.chart.block.Blockorg.jfree.data.category.CategoryDatasetVARIABLE_TYPE_MISMATCH
    org.jfree.chart.block.BorderArrangementorg.jfree.chart.entity.CategoryItemEntityVARIABLE_TYPE_MISMATCH
    topBlockdatasetVARIABLE_NAME_MISMATCH
    org.jfree.chart.block.Blockorg.jfree.data.category.CategoryDatasetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.block.Block of variable this.topBlock does not match with type org.jfree.data.category.CategoryDataset of variable this.dataset
    • Make classes org.jfree.chart.block.Block and org.jfree.data.category.CategoryDataset extend a common superclass
    Type org.jfree.chart.block.Block of variable that.topBlock does not match with type org.jfree.data.category.CategoryDataset of variable that.dataset
    • Make classes org.jfree.chart.block.BorderArrangement and org.jfree.chart.entity.CategoryItemEntity extend a common superclass
    Expression that.topBlock cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.dataset cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.chart.block.Block of variable that.topBlock does not match with type org.jfree.data.category.CategoryDataset of variable that.dataset
    • Make classes org.jfree.chart.block.Block and org.jfree.data.category.CategoryDataset extend a common superclass
    10
    if (!ObjectUtilities.equal(this.dataset, that.dataset))
    7
    return false;
    11
    return false;
                                                                                                    
    12
    if (this.categoryIndex != that.categoryIndex)
                                      
    13
    return false;
    Preondition Violations
    Unmatched return false;
    13
    return false;
                                                                        
    14
    if (this.series != that.series)
                                      
    15
    return false;
    Preondition Violations
    Unmatched return false;
    15
    return false;
    8
    if (!ObjectUtilities.equal(this.bottomBlock, that.bottomBlock))
    8
    if (!ObjectUtilities.equal(this.bottomBlock, that.bottomBlock))
    16
    if (!ObjectUtilities.equal(this.category, that.category))
    Differences
    Expression1Expression2Difference
    bottomBlockcategoryVARIABLE_NAME_MISMATCH
    org.jfree.chart.block.Blockjava.lang.ObjectVARIABLE_TYPE_MISMATCH
    org.jfree.chart.block.BorderArrangementorg.jfree.chart.entity.CategoryItemEntityVARIABLE_TYPE_MISMATCH
    bottomBlockcategoryVARIABLE_NAME_MISMATCH
    org.jfree.chart.block.Blockjava.lang.ObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.block.Block of variable this.bottomBlock does not match with type java.lang.Object of variable this.category
    • Make classes org.jfree.chart.block.Block and java.lang.Object extend a common superclass
    Type org.jfree.chart.block.Block of variable that.bottomBlock does not match with type java.lang.Object of variable that.category
    • Make classes org.jfree.chart.block.BorderArrangement and org.jfree.chart.entity.CategoryItemEntity extend a common superclass
    Expression that.bottomBlock cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.category cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.chart.block.Block of variable that.bottomBlock does not match with type java.lang.Object of variable that.category
    • Make classes org.jfree.chart.block.Block and java.lang.Object extend a common superclass
    16
    if (!ObjectUtilities.equal(this.category, that.category))
    9
    return false;
    17
    return false;
    10
    if (!ObjectUtilities.equal(this.leftBlock, that.leftBlock))
    10
    if (!ObjectUtilities.equal(this.leftBlock, that.leftBlock))
    8
    if (!this.columnKey.equals(that.columnKey))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.leftBlock,that.leftBlock)this.columnKey.equals(that.columnKey)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.leftBlock,that.leftBlock) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.columnKey.equals(that.columnKey) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (!this.columnKey.equals(that.columnKey))
    11
    return false;
    9
    return false;
    12
    if (!ObjectUtilities.equal(this.rightBlock, that.rightBlock))
    12
    if (!ObjectUtilities.equal(this.rightBlock, that.rightBlock))
    6
    if (!this.rowKey.equals(that.rowKey))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.rightBlock,that.rightBlock)this.rowKey.equals(that.rowKey)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.rightBlock,that.rightBlock) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.rowKey.equals(that.rowKey) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (!this.rowKey.equals(that.rowKey))
    13
    return false;
    7
    return false;
    Precondition Violations (19)
    Row Violation
    1Type org.jfree.chart.block.BorderArrangement does not match with type org.jfree.chart.entity.CategoryItemEntity
    2Type org.jfree.chart.block.Block of variable this.topBlock does not match with type org.jfree.data.category.CategoryDataset of variable this.dataset
    3Type org.jfree.chart.block.Block of variable that.topBlock does not match with type org.jfree.data.category.CategoryDataset of variable that.dataset
    4Expression that.topBlock cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.dataset cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type org.jfree.chart.block.Block of variable that.topBlock does not match with type org.jfree.data.category.CategoryDataset of variable that.dataset
    7Unmatched return false;
    8Unmatched return false;
    9Type org.jfree.chart.block.Block of variable this.bottomBlock does not match with type java.lang.Object of variable this.category
    10Type org.jfree.chart.block.Block of variable that.bottomBlock does not match with type java.lang.Object of variable that.category
    11Expression that.bottomBlock cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression that.category cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Type org.jfree.chart.block.Block of variable that.bottomBlock does not match with type java.lang.Object of variable that.category
    14Expression ObjectUtilities.equal(this.leftBlock,that.leftBlock) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression this.columnKey.equals(that.columnKey) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Expression ObjectUtilities.equal(this.rightBlock,that.rightBlock) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression this.rowKey.equals(that.rowKey) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Not all possible execution flows end in a return statement
    19The refactoring of the clones is infeasible, because classes org.jfree.chart.block.BorderArrangement and org.jfree.chart.entity.CategoryItemEntity do not have a common superclass