int result = -1; for (int i = 0; i < this.datasets.size(); i++) { if (dataset == this.datasets.get(i)) { result = i; break; } } return result;
int result = -1; for (int i = 0; i < this.categoryKeys.length; i++) { if (category.equals(this.categoryKeys[i])) { result = i; break; } } return result;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java File path: /jfreechart-1.0.10/src/org/jfree/data/category/DefaultIntervalCategoryDataset.java
Method name: int indexOf(XYDataset) Method name: int getCategoryIndex(Comparable)
Number of AST nodes: 6 Number of AST nodes: 6
1
int result = -1;
1
int result = -1;
2
        for (int i = 0; i < this.datasets.size(); i++) {
2
        for (int i = 0; i < this.categoryKeys.length; i++) {
3
            if (dataset == this.datasets.get(i)) {
3
            if (category.equals(this.categoryKeys[i])) {
4
                result = i;
4
                result = i;
5
                break;
5
                break;
6
            }
6
            }
7
        }
7
        }
8
        return result;
8
        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.1
Clones locationClones are in different classes
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)2.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    int result = -1;
    1
    int result = -1;
    2
    for (int i = 0; i < this.datasets.size(); i++)
    2
    for (int i = 0; i < this.datasets.size(); i++)
    2
    for (int i = 0; i < this.categoryKeys.length; i++)
    Differences
    Expression1Expression2Difference
    this.datasets.size()this.categoryKeys.lengthTYPE_COMPATIBLE_REPLACEMENT
    2
    for (int i = 0; i < this.categoryKeys.length; i++)
                                                                                            
    3
    if (category.equals(this.categoryKeys[i]))
    Preondition Violations
    Unmatched statement if(category.equals(this.categoryKeys[i])) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    if (category.equals(this.categoryKeys[i]))
                            
    4
    result = i;
    Preondition Violations
    Unmatched statement result=i; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    result = i;
                      
    5
    break;
    Preondition Violations
    Unmatched break;
    5
    break;
    3
    if (dataset == this.datasets.get(i))
    3
    if (dataset == this.datasets.get(i))
    Preondition Violations
    Unmatched statement if(dataset == this.datasets.get(i)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                
    4
    result = i;
    4
    result = i;
    Preondition Violations
    Unmatched statement result=i; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                            
    5
    break;
    5
    break;
    Preondition Violations
    Unmatched break;
                      
    6
    return result;
    6
    return result;
    Precondition Violations (7)
    Row Violation
    1Unmatched statement if(category.equals(this.categoryKeys[i])) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement result=i; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched break;
    4Unmatched statement if(dataset == this.datasets.get(i)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement result=i; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched break;
    7Clone fragment #1 returns variables i, result , while Clone fragment #2 returns variables i, result