Task result = null; int count = this.tasks.size(); for (int i = 0; i < count; i++) { Task t = (Task) this.tasks.get(i); if (t.getDescription().equals(description)) { result = t; break; } } return result;
int result = -1; int count = this.data.size(); for (int i = 0; i < count; i++) { TaskSeries s = (TaskSeries) this.data.get(i); if (s.getKey().equals(rowKey)) { result = i; break; } } return result;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/gantt/TaskSeries.java File path: /jfreechart-1.0.10/src/org/jfree/data/gantt/TaskSeriesCollection.java
Method name: Task get(String) Method name: int getRowIndex(Comparable)
Number of AST nodes: 8 Number of AST nodes: 8
1
Task result = null;
1
int result = -1;
2
        int count = this.tasks.size();
2
        int count = this.data.size();
3
        for (int i = 0; i < count; i++) {
3
        for (int i = 0; i < count; i++) {
4
            Task t = (Task) this.tasks.get(i);
4
            TaskSeries s = (TaskSeries) this.data.get(i);
5
            if (t.getDescription().equals(description)) {
5
            if (s.getKey().equals(rowKey)) {
6
                result = t;
6
                result = i;
7
                break;
7
                break;
8
            }
8
            }
9
        }
9
        }
10
        return result;
10
        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
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment6
    Number of unmapped statements in the second code fragment6
    Time elapsed for statement mapping (ms)2.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                      
    1
    int result = -1;
    1
    Task result = null;
                                            
    2
    int count = this.tasks.size();
    2
    int count = this.tasks.size();
    2
    int count = this.data.size();
    Differences
    Expression1Expression2Difference
    tasksdataVARIABLE_NAME_MISMATCH
    2
    int count = this.data.size();
    3
    for (int i = 0; i < count; i++)
    3
    for (int i = 0; i < count; i++)
                                                                                              
    4
    TaskSeries s = (TaskSeries)this.data.get(i);
    Preondition Violations
    Unmatched statement TaskSeries s=(TaskSeries)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
    TaskSeries s = (TaskSeries)this.data.get(i);
    4
    Task t = (Task)this.tasks.get(i);
    4
    Task t = (Task)this.tasks.get(i);
    Preondition Violations
    Unmatched statement Task t=(Task)this.tasks.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                        
                                                                    
    5
    if (s.getKey().equals(rowKey))
                            
    6
    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
    6
    result = i;
                      
    7
    break;
    Preondition Violations
    Unmatched break;
    7
    break;
    5
    if (t.getDescription().equals(description))
                                                                                              
    6
    result = t;
    6
    result = t;
    Preondition Violations
    Unmatched statement result=t; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                            
    7
    break;
    7
    break;
    Preondition Violations
    Unmatched break;
                      
                                      
    8
    return result;
    Preondition Violations
    Unmatched return result;
    8
    return result;
    8
    return result;
    8
    return result;
    Preondition Violations
    Unmatched return result;
                                      
    Precondition Violations (8)
    Row Violation
    1Unmatched statement TaskSeries s=(TaskSeries)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 Task t=(Task)this.tasks.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement result=i; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched break;
    5Unmatched statement result=t; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched break;
    7Unmatched return result;
    8Unmatched return result;