if (obj == this) { return true; } // now try to reject equality... if (!super.equals(obj)) { return false; } if (!(obj instanceof XYImageAnnotation)) { return false; } XYImageAnnotation that = (XYImageAnnotation) obj; if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (!ObjectUtilities.equal(this.image, that.image)) { return false; } if (!this.anchor.equals(that.anchor)) { return false; } // seems to be the same... return true;
if (obj == this) { return true; } if (!(obj instanceof DefaultIntervalCategoryDataset)) { return false; } DefaultIntervalCategoryDataset that = (DefaultIntervalCategoryDataset) obj; if (!Arrays.equals(this.seriesKeys, that.seriesKeys)) { return false; } if (!Arrays.equals(this.categoryKeys, that.categoryKeys)) { return false; } if (!equal(this.startData, that.startData)) { return false; } if (!equal(this.endData, that.endData)) { return false; } // seem to be the same... return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYImageAnnotation.java File path: /jfreechart-1.0.10/src/org/jfree/data/category/DefaultIntervalCategoryDataset.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 16 Number of AST nodes: 14
1
if (obj == this) {
1
if (obj == this) {
2
            return true;
2
            return true;
3
        }
3
        }
4
        // now try to reject equality...
4
        
5
        if (!super.equals(obj)) {
6
            return false;
7
        }
8
        if (!(obj instanceof XYImageAnnotation)) {
9
            return false;
5
if (!(obj instanceof DefaultIntervalCategoryDataset)) {
6
            return false;
7
        }
8
        DefaultIntervalCategoryDataset that 
10
        }
9
        
11
        XYImageAnnotation that = (XYImageAnnotation) obj;
10
        
12
        if (this.x != that.x
11
= (DefaultIntervalCategoryDataset) obj;
13
) {
12
        if (!Arrays.equals(this.seriesKeys, that.seriesKeys)) {
14
            return false;
13
            return false;
15
        }
14
        }
16
        if (this.y != that.y) {
15
        if (!Arrays.equals(this.categoryKeys, that.categoryKeys)) {
17
            return false;
16
            return false;
18
        }
17
        }
19
        if (!ObjectUtilities.equal(this.image, that.image)) {
18
        if (!equal(this.startData, that.startData)) {
20
            return false;
19
            return false;
21
        }
20
        }
22
        if (!this.anchor.equals(that.anchor)) {
21
        if (!equal(this.endData, that.endData)) {
23
            return false;
22
            return false;
24
        }
23
        }
25
        // seems to be the same...
24
        // seem to be the same...
26
        return true;
25
        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)3.8
Clones locationClones are in different classes
Number of node comparisons64
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment7
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.8
    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 (!super.equals(obj))
    3
    if (!super.equals(obj))
    3
    if (!(obj instanceof DefaultIntervalCategoryDataset))
    Differences
    Expression1Expression2Difference
    super.equals(obj)(obj instanceof DefaultIntervalCategoryDataset)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Super method call if(!super.equals(obj)) cannot be extracted from method
    3
    if (!(obj instanceof DefaultIntervalCategoryDataset))
    4
    return false;
    4
    return false;
                                                                                                                                                          
    5
    DefaultIntervalCategoryDataset that = (DefaultIntervalCategoryDataset)obj;
    5
    if (!(obj instanceof XYImageAnnotation))
    5
    if (!(obj instanceof XYImageAnnotation))
    6
    if (!Arrays.equals(this.seriesKeys, that.seriesKeys))
    Differences
    Expression1Expression2Difference
    (obj instanceof XYImageAnnotation)Arrays.equals(this.seriesKeys,that.seriesKeys)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression Arrays.equals(this.seriesKeys,that.seriesKeys) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (!Arrays.equals(this.seriesKeys, that.seriesKeys))
    6
    return false;
    7
    return false;
    7
    XYImageAnnotation that = (XYImageAnnotation)obj;
                                                                                                      
    8
    if (this.x != that.x)
                                                  
    9
    return false;
    9
    return false;
    Preondition Violations
    Unmatched return false;
                                    
    10
    if (this.y != that.y)
                                                    
    11
    return false;
    11
    return false;
    Preondition Violations
    Unmatched return false;
                                      
    12
    if (!ObjectUtilities.equal(this.image, that.image))
                                                                                                              
    13
    return false;
    13
    return false;
    Preondition Violations
    Unmatched return false;
                                      
    14
    if (!this.anchor.equals(that.anchor))
    14
    if (!this.anchor.equals(that.anchor))
    8
    if (!Arrays.equals(this.categoryKeys, that.categoryKeys))
    Differences
    Expression1Expression2Difference
    this.anchor.equals(that.anchor)Arrays.equals(this.categoryKeys,that.categoryKeys)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.anchor.equals(that.anchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression Arrays.equals(this.categoryKeys,that.categoryKeys) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (!Arrays.equals(this.categoryKeys, that.categoryKeys))
    15
    return false;
    9
    return false;
    Precondition Violations (9)
    Row Violation
    1Super method call if(!super.equals(obj)) cannot be extracted from method
    2Expression Arrays.equals(this.seriesKeys,that.seriesKeys) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched return false;
    4Unmatched return false;
    5Unmatched return false;
    6Expression this.anchor.equals(that.anchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression Arrays.equals(this.categoryKeys,that.categoryKeys) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Not all possible execution flows end in a return statement
    9The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYImageAnnotation and org.jfree.data.category.DefaultIntervalCategoryDataset do not have a common superclass