int result = super.hashCode(); // it is too slow to look at every data item, so let's just look at // the first, middle and last items... int count = getItemCount(); if (count > 0) { ComparableObjectItem item = getDataItem(0); result = 29 * result + item.hashCode(); } if (count > 1) { ComparableObjectItem item = getDataItem(count - 1); result = 29 * result + item.hashCode(); } if (count > 2) { ComparableObjectItem item = getDataItem(count / 2); result = 29 * result + item.hashCode(); } result = 29 * result + this.maximumItemCount; result = 29 * result + (this.autoSort ? 1 : 0); result = 29 * result + (this.allowDuplicateXValues ? 1 : 0); return result;
int result = super.hashCode(); // it is too slow to look at every data item, so let's just look at // the first, middle and last items... int count = getItemCount(); if (count > 0) { XYDataItem item = getDataItem(0); result = 29 * result + item.hashCode(); } if (count > 1) { XYDataItem item = getDataItem(count - 1); result = 29 * result + item.hashCode(); } if (count > 2) { XYDataItem item = getDataItem(count / 2); result = 29 * result + item.hashCode(); } result = 29 * result + this.maximumItemCount; result = 29 * result + (this.autoSort ? 1 : 0); result = 29 * result + (this.allowDuplicateXValues ? 1 : 0); return result;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/ComparableObjectSeries.java File path: /jfreechart-1.0.10/src/org/jfree/data/xy/XYSeries.java
Method name: int hashCode() Method name: int hashCode()
Number of AST nodes: 15 Number of AST nodes: 15
1
int result = super.hashCode();
1
int result = super.hashCode();
2
        // it is too slow to look at every data item, so let's just look at
2
        // it is too slow to look at every data item, so let's just look at
3
        // the first, middle and last items...
3
        // the first, middle and last items...
4
        int count = getItemCount();
4
        int count = getItemCount();
5
        if (count > 0) {
5
        if (count > 0) {
6
            ComparableObjectItem item = getDataItem(0);
6
            XYDataItem item = getDataItem(0);
7
            result = 29 * result + item.hashCode();
7
            result = 29 * result + item.hashCode();
8
        }
8
        }
9
        if (count > 1) {
9
        if (count > 1) {
10
            ComparableObjectItem item = getDataItem(count - 1);
10
            XYDataItem item = getDataItem(count - 1);
11
            result = 29 * result + item.hashCode();
11
            result = 29 * result + item.hashCode();
12
        }
12
        }
13
        if (count > 2) {
13
        if (count > 2) {
14
            ComparableObjectItem item = getDataItem(count / 2);
14
            XYDataItem item = getDataItem(count / 2);
15
            result = 29 * result + item.hashCode();
15
            result = 29 * result + item.hashCode();
16
        }
16
        }
17
        result = 29 * result + this.maximumItemCount;
17
        result = 29 * result + this.maximumItemCount;
18
        result = 29 * result + (this.autoSort ? 1 : 0);
18
        result = 29 * result + (this.autoSort ? 1 : 0);
19
        result = 29 * result + (this.allowDuplicateXValues ? 1 : 0);
19
        result = 29 * result + (this.allowDuplicateXValues ? 1 : 0);
20
        return result;
20
        return result;
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)0.3
Clones locationClones are in different classes having the same super class
Number of node comparisons93
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)7.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    int result = super.hashCode();
    1
    int result = super.hashCode();
    1
    int result = super.hashCode();
    Preondition Violations
    Super method call int result=super.hashCode(); cannot be extracted from method
    Super method call int result=super.hashCode(); cannot be extracted from method
    1
    int result = super.hashCode();
    2
    int count = getItemCount();
    2
    int count = getItemCount();
    3
    if (count > 0)
    3
    if (count > 0)
                                                                        
    4
    XYDataItem item = getDataItem(0);
    4
    ComparableObjectItem item = getDataItem(0);
                                                                                            
    5
    result = 29 * result + item.hashCode();
    5
    result = 29 * result + item.hashCode();
    5
    result = 29 * result + item.hashCode();
    Differences
    Expression1Expression2Difference
    org.jfree.data.ComparableObjectItemorg.jfree.data.xy.XYDataItemVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.data.ComparableObjectItem of variable item does not match with type org.jfree.data.xy.XYDataItem of variable item
    • Make classes org.jfree.data.ComparableObjectItem and org.jfree.data.xy.XYDataItem extend a common superclass
    5
    result = 29 * result + item.hashCode();
    6
    if (count > 1)
    6
    if (count > 1)
                                                                                        
    7
    XYDataItem item = getDataItem(count - 1);
    Preondition Violations
    Unmatched statement XYDataItem item=getDataItem(count - 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    XYDataItem item = getDataItem(count - 1);
    7
    ComparableObjectItem item = getDataItem(count - 1);
    7
    ComparableObjectItem item = getDataItem(count - 1);
    Preondition Violations
    Unmatched statement ComparableObjectItem item=getDataItem(count - 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                            
    8
    result = 29 * result + item.hashCode();
    8
    result = 29 * result + item.hashCode();
    8
    result = 29 * result + item.hashCode();
    Differences
    Expression1Expression2Difference
    org.jfree.data.ComparableObjectItemorg.jfree.data.xy.XYDataItemVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.data.ComparableObjectItem of variable item does not match with type org.jfree.data.xy.XYDataItem of variable item
    • Make classes org.jfree.data.ComparableObjectItem and org.jfree.data.xy.XYDataItem extend a common superclass
    8
    result = 29 * result + item.hashCode();
    9
    if (count > 2)
    9
    if (count > 2)
                                                                                          
    10
    XYDataItem item = getDataItem(count / 2);
    Preondition Violations
    Unmatched statement XYDataItem item=getDataItem(count / 2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    XYDataItem item = getDataItem(count / 2);
    10
    ComparableObjectItem item = getDataItem(count / 2);
    10
    ComparableObjectItem item = getDataItem(count / 2);
    Preondition Violations
    Unmatched statement ComparableObjectItem item=getDataItem(count / 2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                              
    11
    result = 29 * result + item.hashCode();
    11
    result = 29 * result + item.hashCode();
    11
    result = 29 * result + item.hashCode();
    Differences
    Expression1Expression2Difference
    org.jfree.data.ComparableObjectItemorg.jfree.data.xy.XYDataItemVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.data.ComparableObjectItem of variable item does not match with type org.jfree.data.xy.XYDataItem of variable item
    • Make classes org.jfree.data.ComparableObjectItem and org.jfree.data.xy.XYDataItem extend a common superclass
    11
    result = 29 * result + item.hashCode();
    12
    result = 29 * result + this.maximumItemCount;
    12
    result = 29 * result + this.maximumItemCount;
    13
    result = 29 * result + (this.autoSort ? 1 : 0);
    13
    result = 29 * result + (this.autoSort ? 1 : 0);
    14
    result = 29 * result + (this.allowDuplicateXValues ? 1 : 0);
    14
    result = 29 * result + (this.allowDuplicateXValues ? 1 : 0);
    15
    return result;
    15
    return result;
    Precondition Violations (9)
    Row Violation
    1Super method call int result=super.hashCode(); cannot be extracted from method
    2Super method call int result=super.hashCode(); cannot be extracted from method
    3Type org.jfree.data.ComparableObjectItem of variable item does not match with type org.jfree.data.xy.XYDataItem of variable item
    4Unmatched statement XYDataItem item=getDataItem(count - 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement ComparableObjectItem item=getDataItem(count - 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Type org.jfree.data.ComparableObjectItem of variable item does not match with type org.jfree.data.xy.XYDataItem of variable item
    7Unmatched statement XYDataItem item=getDataItem(count / 2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement ComparableObjectItem item=getDataItem(count / 2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Type org.jfree.data.ComparableObjectItem of variable item does not match with type org.jfree.data.xy.XYDataItem of variable item