for (int i = 0; i < this.data.size(); i++) { ComparableObjectItem item = (ComparableObjectItem) this.data.get(i); if (item.getComparable().equals(x)) { return i; } } return -1;
for (int i = 0; i < this.data.size(); i++) { XYDataItem item = (XYDataItem) this.data.get(i); if (item.getX().equals(x)) { return i; } } return -1;
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 indexOf(Comparable) Method name: int indexOf(Number)
Number of AST nodes: 5 Number of AST nodes: 5
1
for (int i = 0; i < this.data.size(); i++) {
1
for (int i = 0; i < this.data.size(); i++) {
2
                ComparableObjectItem item = (ComparableObjectItem) 
2
                
3
                        this.data.get(i);
3
XYDataItem item = (XYDataItem) this.data.get(i);
4
                if (item.getComparable().equals(x)) {
4
                if (item.getX().equals(x)) {
5
                    return i;   
5
                    return i;
6
                }
6
                }
7
            }
7
            }
8
            return -1;
8
            return -1;
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.5
Clones locationClones are in different classes having the same super class
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)7.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    for (int i = 0; i < this.data.size(); i++)
    3
    for (int i = 0; i < this.data.size(); i++)
                                                                                                    
    4
    XYDataItem item = (XYDataItem)this.data.get(i);
    Preondition Violations
    Unmatched statement XYDataItem item=(XYDataItem)this.data.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    XYDataItem item = (XYDataItem)this.data.get(i);
    4
    ComparableObjectItem item = (ComparableObjectItem)this.data.get(i);
    4
    ComparableObjectItem item = (ComparableObjectItem)this.data.get(i);
    Preondition Violations
    Unmatched statement ComparableObjectItem item=(ComparableObjectItem)this.data.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                            
    5
    if (item.getComparable().equals(x))
    5
    if (item.getComparable().equals(x))
    5
    if (item.getX().equals(x))
    Differences
    Expression1Expression2Difference
    java.lang.Comparablejava.lang.NumberVARIABLE_TYPE_MISMATCH
    getComparablegetXMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Comparablejava.lang.NumberVARIABLE_TYPE_MISMATCH
    org.jfree.data.ComparableObjectItemorg.jfree.data.xy.XYDataItemVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Comparable of variable x does not match with type java.lang.Number of variable x
    • Make classes java.lang.Comparable and java.lang.Number extend a common superclass
    Expression item.getComparable() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression item.getX() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.Comparable of variable item.getComparable() does not match with type java.lang.Number of variable item.getX()
    • Make classes java.lang.Comparable and java.lang.Number extend a common superclass
    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
    if (item.getX().equals(x))
    6
    return i;
    6
    return i;
    7
    return -1;
    7
    return -1;
    Precondition Violations (8)
    Row Violation
    1Unmatched statement XYDataItem item=(XYDataItem)this.data.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement ComparableObjectItem item=(ComparableObjectItem)this.data.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type java.lang.Comparable of variable x does not match with type java.lang.Number of variable x
    4Expression item.getComparable() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression item.getX() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type java.lang.Comparable of variable item.getComparable() does not match with type java.lang.Number of variable item.getX()
    7Type org.jfree.data.ComparableObjectItem of variable item does not match with type org.jfree.data.xy.XYDataItem of variable item
    8Not all possible execution flows end in a return statement