if (this == obj) { return true; } if (obj instanceof Tick) { Tick t = (Tick) obj; if (!ObjectUtilities.equal(this.text, t.text)) { return false; } if (!ObjectUtilities.equal(this.textAnchor, t.textAnchor)) { return false; } if (!ObjectUtilities.equal(this.rotationAnchor, t.rotationAnchor)) { return false; } if (!(this.angle == t.angle)) { return false; } return true; } return false;
if (obj == this) { return true; } if (!(obj instanceof PieSectionEntity)) { return false; } PieSectionEntity that = (PieSectionEntity) obj; if (!ObjectUtilities.equal(this.dataset, that.dataset)) { return false; } if (this.pieIndex != that.pieIndex) { return false; } if (this.sectionIndex != that.sectionIndex) { return false; } if (!ObjectUtilities.equal(this.sectionKey, that.sectionKey)) { return false; } return super.equals(obj);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/Tick.java File path: /jfreechart-1.0.10/src/org/jfree/chart/entity/PieSectionEntity.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 14 Number of AST nodes: 14
1
if (this == obj) {
1
if (obj == this) {
2
            return true;   
2
            return true;
3
        }
3
        }
4
        if (obj instanceof Tick) {
4
        if (!(obj instanceof 
5
            Tick t = (Tick) obj;   
6
    
5
PieSectionEntity)) {
6
            return false;
7
        }
8
        PieSectionEntity that = (PieSectionEntity) obj;
7
        if (!ObjectUtilities.equal(this.text, t.text)) {
9
        if (!ObjectUtilities.equal(this.dataset, that.dataset)) {
8
                return false;   
10
            return false;
9
    
10
        }
11
        }
11
            if (!ObjectUtilities.equal(this.textAnchor, t.textAnchor)) {
12
        if (this.pieIndex != that.pieIndex) {
12
                return false;   
13
            return false;
13
            }
14
        }
14
            if (!ObjectUtilities.equal(this.rotationAnchor, t.rotationAnchor)) {
15
        if (this.sectionIndex != that.sectionIndex) {
15
                return false;   
16
            return false;
16
  
17
          }
17
        }
18
            if (!(this.angle == t.angle)) {
18
        if (!ObjectUtilities.equal(this.sectionKey, that.sectionKey)) {
19
                return false;   
19
            return false;
20
    
21
        }
20
        }
22
            return true;
21
        return 
23
        }
24
        return false;
22
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.4
Clones locationClones are in different classes
Number of node comparisons43
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)2.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    4
    Tick t = (Tick)obj;
                                            
                                                                                                  
    5
    PieSectionEntity that = (PieSectionEntity)obj;
    5
    if (!ObjectUtilities.equal(this.text, t.text))
    5
    if (!ObjectUtilities.equal(this.text, t.text))
    6
    if (!ObjectUtilities.equal(this.dataset, that.dataset))
    Differences
    Expression1Expression2Difference
    textdatasetVARIABLE_NAME_MISMATCH
    java.lang.Stringorg.jfree.data.general.PieDatasetVARIABLE_TYPE_MISMATCH
    tthatVARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.Tickorg.jfree.chart.entity.PieSectionEntityVARIABLE_TYPE_MISMATCH
    textdatasetVARIABLE_NAME_MISMATCH
    java.lang.Stringorg.jfree.data.general.PieDatasetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable this.text does not match with type org.jfree.data.general.PieDataset of variable this.dataset
    • Make classes java.lang.String and org.jfree.data.general.PieDataset extend a common superclass
    Expression t.text 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.lang.String of variable t.text does not match with type org.jfree.data.general.PieDataset of variable that.dataset
    • Make classes org.jfree.chart.axis.Tick and org.jfree.chart.entity.PieSectionEntity extend a common superclass
    Expression t.text 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.lang.String of variable t.text does not match with type org.jfree.data.general.PieDataset of variable that.dataset
    • Make classes java.lang.String and org.jfree.data.general.PieDataset extend a common superclass
    6
    if (!ObjectUtilities.equal(this.dataset, that.dataset))
    6
    return false;
    7
    return false;
                                                                              
    8
    if (this.pieIndex != that.pieIndex)
                                    
    9
    return false;
    Preondition Violations
    Unmatched return false;
    9
    return false;
                                                                                                
    10
    if (this.sectionIndex != that.sectionIndex)
                                      
    11
    return false;
    Preondition Violations
    Unmatched return false;
    11
    return false;
    7
    if (!ObjectUtilities.equal(this.textAnchor, t.textAnchor))
    7
    if (!ObjectUtilities.equal(this.textAnchor, t.textAnchor))
    12
    if (!ObjectUtilities.equal(this.sectionKey, that.sectionKey))
    Differences
    Expression1Expression2Difference
    textAnchorsectionKeyVARIABLE_NAME_MISMATCH
    org.jfree.ui.TextAnchorjava.lang.ComparableVARIABLE_TYPE_MISMATCH
    tthatVARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.Tickorg.jfree.chart.entity.PieSectionEntityVARIABLE_TYPE_MISMATCH
    textAnchorsectionKeyVARIABLE_NAME_MISMATCH
    org.jfree.ui.TextAnchorjava.lang.ComparableVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.ui.TextAnchor of variable this.textAnchor does not match with type java.lang.Comparable of variable this.sectionKey
    • Make classes org.jfree.ui.TextAnchor and java.lang.Comparable extend a common superclass
    Expression t.textAnchor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.sectionKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.ui.TextAnchor of variable t.textAnchor does not match with type java.lang.Comparable of variable that.sectionKey
    • Make classes org.jfree.chart.axis.Tick and org.jfree.chart.entity.PieSectionEntity extend a common superclass
    Expression t.textAnchor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.sectionKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.jfree.ui.TextAnchor of variable t.textAnchor does not match with type java.lang.Comparable of variable that.sectionKey
    • Make classes org.jfree.ui.TextAnchor and java.lang.Comparable extend a common superclass
    12
    if (!ObjectUtilities.equal(this.sectionKey, that.sectionKey))
    8
    return false;
    13
    return false;
    9
    if (!ObjectUtilities.equal(this.rotationAnchor, t.rotationAnchor))
    9
    if (!ObjectUtilities.equal(this.rotationAnchor, t.rotationAnchor))
    3
    if (!(obj instanceof PieSectionEntity))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.rotationAnchor,t.rotationAnchor)(obj instanceof PieSectionEntity)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.rotationAnchor,t.rotationAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    if (!(obj instanceof PieSectionEntity))
    10
    return false;
    4
    return false;
    Precondition Violations (18)
    Row Violation
    1Type java.lang.String of variable this.text does not match with type org.jfree.data.general.PieDataset of variable this.dataset
    2Expression t.text cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression that.dataset cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Type java.lang.String of variable t.text does not match with type org.jfree.data.general.PieDataset of variable that.dataset
    5Expression t.text cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression that.dataset cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Type java.lang.String of variable t.text does not match with type org.jfree.data.general.PieDataset of variable that.dataset
    8Unmatched return false;
    9Unmatched return false;
    10Type org.jfree.ui.TextAnchor of variable this.textAnchor does not match with type java.lang.Comparable of variable this.sectionKey
    11Expression t.textAnchor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression that.sectionKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Type org.jfree.ui.TextAnchor of variable t.textAnchor does not match with type java.lang.Comparable of variable that.sectionKey
    14Expression t.textAnchor cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression that.sectionKey cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Type org.jfree.ui.TextAnchor of variable t.textAnchor does not match with type java.lang.Comparable of variable that.sectionKey
    17Expression ObjectUtilities.equal(this.rotationAnchor,t.rotationAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Not all possible execution flows end in a return statement