if (obj == this) { return true; } if (!(obj instanceof DateTickUnit)) { return false; } if (!super.equals(obj)) { return false; } DateTickUnit that = (DateTickUnit) obj; if (this.unit != that.unit) { return false; } if (this.count != that.count) { return false; } if (!ObjectUtilities.equal(this.formatter, that.formatter)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof ItemLabelPosition)) { return false; } ItemLabelPosition that = (ItemLabelPosition) obj; if (!this.itemLabelAnchor.equals(that.itemLabelAnchor)) { return false; } if (!this.textAnchor.equals(that.textAnchor)) { return false; } if (!this.rotationAnchor.equals(that.rotationAnchor)) { return false; } if (this.angle != that.angle) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/DateTickUnit.java File path: /jfreechart-1.0.10/src/org/jfree/chart/labels/ItemLabelPosition.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 14 Number of AST nodes: 14
1
if (obj == this) {
1
if (obj == this) {
2
            return true;
2
            return true;
3
        }
3
        }    
4
        if (!(obj instanceof DateTickUnit)) {
4
        if (!(obj instanceof ItemLabelPosition)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        if (!super.equals(obj
7
        ItemLabelPosition that = (ItemLabelPosition) obj;
8
)) {
8
        if (!this.itemLabelAnchor.equals(that.itemLabelAnchor)) {
9
            return false;
9
            return false;
10
        }
10
        }
11
        DateTickUnit that = (DateTickUnit) obj;
12
        if (this.unit != that.unit) {
11
        if (!this.textAnchor.equals(that.textAnchor)) {
13
            return false;
12
            return false;
14
        }
13
        }
15
        if (this.count != that.count) {
14
        if (!this.rotationAnchor.equals(that.rotationAnchor)) {
16
            return false;
15
            return false;
17
        }
16
        }
18
        if (!ObjectUtilities.equal(this.formatter, that.formatter)) {
17
        if (this.angle != that.angle) {
19
            return false;
18
            return false;
20
        }
19
        }     
21
        return true;
20
        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)1.7
Clones locationClones are in different classes
Number of node comparisons70
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)9.6
    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 DateTickUnit))
    3
    if (!(obj instanceof DateTickUnit))
    3
    if (!(obj instanceof ItemLabelPosition))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.DateTickUnitorg.jfree.chart.labels.ItemLabelPositionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.axis.DateTickUnit does not match with type org.jfree.chart.labels.ItemLabelPosition
    • Make classes org.jfree.chart.axis.DateTickUnit and org.jfree.chart.labels.ItemLabelPosition extend a common superclass
    3
    if (!(obj instanceof ItemLabelPosition))
    4
    return false;
    4
    return false;
                                                                                                      
    5
    ItemLabelPosition that = (ItemLabelPosition)obj;
    5
    if (!super.equals(obj))
    5
    if (!super.equals(obj))
    6
    if (!this.itemLabelAnchor.equals(that.itemLabelAnchor))
    Differences
    Expression1Expression2Difference
    super.equals(obj)this.itemLabelAnchor.equals(that.itemLabelAnchor)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.itemLabelAnchor.equals(that.itemLabelAnchor) 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
    6
    if (!this.itemLabelAnchor.equals(that.itemLabelAnchor))
    6
    return false;
    7
    return false;
    7
    DateTickUnit that = (DateTickUnit)obj;
                                                                                  
                                                                                                  
    8
    if (!this.textAnchor.equals(that.textAnchor))
                                    
    9
    return false;
    Preondition Violations
    Unmatched return false;
    9
    return false;
    8
    if (this.unit != that.unit)
    8
    if (this.unit != that.unit)
    12
    if (this.angle != that.angle)
    Differences
    Expression1Expression2Difference
    unitangleVARIABLE_NAME_MISMATCH
    intdoubleVARIABLE_TYPE_MISMATCH
    org.jfree.chart.axis.DateTickUnitorg.jfree.chart.labels.ItemLabelPositionVARIABLE_TYPE_MISMATCH
    unitangleVARIABLE_NAME_MISMATCH
    intdoubleVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable this.unit does not match with type double of variable this.angle
    Type int of variable that.unit does not match with type double of variable that.angle
    • Make classes org.jfree.chart.axis.DateTickUnit and org.jfree.chart.labels.ItemLabelPosition extend a common superclass
    Expression that.unit cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.angle cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type int of variable that.unit does not match with type double of variable that.angle
    12
    if (this.angle != that.angle)
    9
    return false;
    13
    return false;
    10
    if (this.count != that.count)
                                                                    
    11
    return false;
    11
    return false;
    Preondition Violations
    Unmatched return false;
                                      
    12
    if (!ObjectUtilities.equal(this.formatter, that.formatter))
    12
    if (!ObjectUtilities.equal(this.formatter, that.formatter))
    10
    if (!this.rotationAnchor.equals(that.rotationAnchor))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.formatter,that.formatter)this.rotationAnchor.equals(that.rotationAnchor)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.formatter,that.formatter) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.rotationAnchor.equals(that.rotationAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (!this.rotationAnchor.equals(that.rotationAnchor))
    13
    return false;
    11
    return false;
    Precondition Violations (14)
    Row Violation
    1Type org.jfree.chart.axis.DateTickUnit does not match with type org.jfree.chart.labels.ItemLabelPosition
    2Expression this.itemLabelAnchor.equals(that.itemLabelAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Super method call if(!super.equals(obj)) cannot be extracted from method
    4Unmatched return false;
    5Type int of variable this.unit does not match with type double of variable this.angle
    6Type int of variable that.unit does not match with type double of variable that.angle
    7Expression that.unit cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression that.angle cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type int of variable that.unit does not match with type double of variable that.angle
    10Unmatched return false;
    11Expression ObjectUtilities.equal(this.formatter,that.formatter) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression this.rotationAnchor.equals(that.rotationAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Not all possible execution flows end in a return statement
    14The refactoring of the clones is infeasible, because classes org.jfree.chart.axis.DateTickUnit and org.jfree.chart.labels.ItemLabelPosition do not have a common superclass