if (obj == this) { return true; } if (!(obj instanceof CategoryLineAnnotation)) { return false; } CategoryLineAnnotation that = (CategoryLineAnnotation) obj; if (!this.category1.equals(that.getCategory1())) { return false; } if (this.value1 != that.getValue1()) { return false; } if (!this.category2.equals(that.getCategory2())) { return false; } if (this.value2 != that.getValue2()) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { 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/annotations/CategoryLineAnnotation.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: 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 CategoryLineAnnotation)) {
4
        if (!(obj instanceof CategoryItemEntity)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        CategoryLineAnnotation that = (CategoryLineAnnotation) obj;
7
        CategoryItemEntity that = (CategoryItemEntity) obj;
8
        if (!this.category1.equals(that.getCategory1())) {
8
        if (!this.rowKey.equals(that.rowKey)) {
9
            return false;
9
            return false;
10
        }
10
        }
11
        if (this.value1 != that.getValue1()) {
11
        if (!this.columnKey.equals(that.columnKey)) {
12
            return false;
12
            return false;
13
        }
13
        }
14
        if (!this.category2.equals(that.getCategory2())) {
14
        if (!ObjectUtilities.equal(this.dataset, that.dataset)) {
15
            return false;
15
            return false;
16
        }
16
        }
17
        if (this.value2 != that.getValue2()
17
        
18
        // check the deprecated fields
18
) {
19
        if (this.categoryIndex != that.categoryIndex) {
19
            return false;
20
            return false;   
20
        }
21
        }
21
        if (!PaintUtilities.equal(this.paint, that.paint)) {
22
        if (this.series != that.series) {
22
            return false;
23
            return false;   
23
        }
24
        }
24
        if (!ObjectUtilities.equal(this.stroke, that.stroke)) {
25
        if (!ObjectUtilities.equal(this.category, that.category)) {
25
            return false;
26
            return false;   
26
        }
27
        }
27
        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)5.1
Clones locationClones are in different classes
Number of node comparisons113
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)6.7
    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 CategoryLineAnnotation))
    3
    if (!(obj instanceof CategoryLineAnnotation))
    3
    if (!(obj instanceof CategoryItemEntity))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.CategoryLineAnnotationorg.jfree.chart.entity.CategoryItemEntitySUBCLASS_TYPE_MISMATCH
    3
    if (!(obj instanceof CategoryItemEntity))
    4
    return false;
    4
    return false;
    5
    CategoryLineAnnotation that = (CategoryLineAnnotation)obj;
    5
    CategoryLineAnnotation that = (CategoryLineAnnotation)obj;
    5
    CategoryItemEntity that = (CategoryItemEntity)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.CategoryLineAnnotationorg.jfree.chart.entity.CategoryItemEntitySUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.CategoryLineAnnotationorg.jfree.chart.entity.CategoryItemEntitySUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.CategoryLineAnnotationorg.jfree.chart.entity.CategoryItemEntitySUBCLASS_TYPE_MISMATCH
    5
    CategoryItemEntity that = (CategoryItemEntity)obj;
    6
    if (!this.category1.equals(that.getCategory1()))
    6
    if (!this.category1.equals(that.getCategory1()))
    6
    if (!this.rowKey.equals(that.rowKey))
    Differences
    Expression1Expression2Difference
    that.getCategory1()that.rowKeyTYPE_COMPATIBLE_REPLACEMENT
    category1rowKeyVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.getCategory1() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.rowKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (!this.rowKey.equals(that.rowKey))
    7
    return false;
    7
    return false;
    8
    if (this.value1 != that.getValue1())
    8
    if (this.value1 != that.getValue1())
    Preondition Violations
    Unmatched statement if(this.value1 != that.getValue1()) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                
    9
    return false;
    9
    return false;
    Preondition Violations
    Unmatched return false;
                                    
    10
    if (!this.category2.equals(that.getCategory2()))
    10
    if (!this.category2.equals(that.getCategory2()))
    8
    if (!this.columnKey.equals(that.columnKey))
    Differences
    Expression1Expression2Difference
    that.getCategory2()that.columnKeyTYPE_COMPATIBLE_REPLACEMENT
    category2columnKeyVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.getCategory2() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression 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 (this.categoryIndex != that.categoryIndex)
    Preondition Violations
    Unmatched statement if(this.categoryIndex != that.categoryIndex) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12
    if (this.categoryIndex != that.categoryIndex)
                                      
    13
    return false;
    Preondition Violations
    Unmatched return false;
    13
    return false;
    12
    if (this.value2 != that.getValue2())
    12
    if (this.value2 != that.getValue2())
    Preondition Violations
    Unmatched statement if(this.value2 != that.getValue2()) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                  
    13
    return false;
    13
    return false;
    Preondition Violations
    Unmatched return false;
                                      
                                                                        
    14
    if (this.series != that.series)
    Preondition Violations
    Unmatched statement if(this.series != that.series) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14
    if (this.series != that.series)
                                      
    15
    return false;
    Preondition Violations
    Unmatched return false;
    15
    return false;
    14
    if (!PaintUtilities.equal(this.paint, that.paint))
    14
    if (!PaintUtilities.equal(this.paint, that.paint))
    16
    if (!ObjectUtilities.equal(this.category, that.category))
    Differences
    Expression1Expression2Difference
    paintcategoryVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.lang.ObjectVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.CategoryLineAnnotationorg.jfree.chart.entity.CategoryItemEntitySUBCLASS_TYPE_MISMATCH
    paintcategoryVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.lang.ObjectVARIABLE_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 java.lang.Object of variable this.category
    • Make classes java.awt.Paint and java.lang.Object extend a common superclass
    Expression that.paint 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 java.awt.Paint of variable that.paint does not match with type java.lang.Object of variable that.category
    • Make classes java.awt.Paint and java.lang.Object 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
    16
    if (!ObjectUtilities.equal(this.category, that.category))
    15
    return false;
    17
    return false;
    16
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    16
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    10
    if (!ObjectUtilities.equal(this.dataset, that.dataset))
    Differences
    Expression1Expression2Difference
    strokedatasetVARIABLE_NAME_MISMATCH
    java.awt.Strokeorg.jfree.data.category.CategoryDatasetVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.CategoryLineAnnotationorg.jfree.chart.entity.CategoryItemEntitySUBCLASS_TYPE_MISMATCH
    strokedatasetVARIABLE_NAME_MISMATCH
    java.awt.Strokeorg.jfree.data.category.CategoryDatasetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable this.stroke does not match with type org.jfree.data.category.CategoryDataset of variable this.dataset
    • Make classes java.awt.Stroke and org.jfree.data.category.CategoryDataset extend a common superclass
    Expression that.stroke 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 java.awt.Stroke of variable that.stroke does not match with type org.jfree.data.category.CategoryDataset of variable that.dataset
    • Make classes java.awt.Stroke and org.jfree.data.category.CategoryDataset extend a common superclass
    10
    if (!ObjectUtilities.equal(this.dataset, that.dataset))
    17
    return false;
    11
    return false;
    Precondition Violations (24)
    Row Violation
    1Expression that.getCategory1() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression that.rowKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement if(this.value1 != that.getValue1()) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return false;
    5Expression that.getCategory2() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression that.columnKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Unmatched statement if(this.categoryIndex != that.categoryIndex) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched return false;
    9Unmatched statement if(this.value2 != that.getValue2()) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10Unmatched return false;
    11Unmatched statement if(this.series != that.series) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12Unmatched return false;
    13Type java.awt.Paint of variable this.paint does not match with type java.lang.Object of variable this.category
    14Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression that.category cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Type java.awt.Paint of variable that.paint does not match with type java.lang.Object of variable that.category
    17Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    18Type java.awt.Stroke of variable this.stroke does not match with type org.jfree.data.category.CategoryDataset of variable this.dataset
    19Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    20Expression that.dataset cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21Type java.awt.Stroke of variable that.stroke does not match with type org.jfree.data.category.CategoryDataset of variable that.dataset
    22Clone fragment #1 returns variable that with type org.jfree.chart.annotations.CategoryLineAnnotation , while Clone fragment #2 returns variable that with type org.jfree.chart.entity.CategoryItemEntity
    23Not all possible execution flows end in a return statement
    24The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.CategoryLineAnnotation and org.jfree.chart.entity.CategoryItemEntity do not have a common superclass