for (int i = 0; i < selectors.length; i++) { if (!selectors[i].isSelected(basedir, name, file)) { return false; } }
for (int i = 0; i < arr.length; i++) { if (!couldHoldIncluded(arr[i])) { scandir(new File(basedir, arr[i]), arr[i] + File.separator, false); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/DirectoryScanner.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/DirectoryScanner.java
Method name: boolean isSelected(String, File) Method name: void processSlowScan(String[])
Number of AST nodes: 3 Number of AST nodes: 3
1
for (int i = 0; i < selectors.length; i++) {
1
for (int i = 0; i < arr.length; i++) {
2
                if (!selectors[i].isSelected(basedir, name, file)) {
2
            if (!
3
                    return
3
couldHoldIncluded(arr[i])) {
4
                scandir(new File(basedir, arr[i]),
4
 false;
5
                        arr[i] + File.separator, false);
5
                }
6
            
6
    
7
}
7
        }
8
        }
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 declared in the same class
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    for (int i = 0; i < selectors.length; i++)
    2
    for (int i = 0; i < selectors.length; i++)
    1
    for (int i = 0; i < arr.length; i++)
    Differences
    Expression1Expression2Difference
    selectorsarrVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.types.selectors.FileSelector[]java.lang.String[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.types.selectors.FileSelector[] of variable selectors does not match with type java.lang.String[] of variable arr
    • Make classes org.apache.tools.ant.types.selectors.FileSelector[] and java.lang.String[] extend a common superclass
    1
    for (int i = 0; i < arr.length; i++)
    3
    if (!selectors[i].isSelected(basedir, name, file))
    3
    if (!selectors[i].isSelected(basedir, name, file))
    2
    if (!couldHoldIncluded(arr[i]))
    Differences
    Expression1Expression2Difference
    isSelectedcouldHoldIncludedMETHOD_INVOCATION_NAME_MISMATCH
    selectors[i].isSelected(basedir,name,file)couldHoldIncluded(arr[i])ARGUMENT_NUMBER_MISMATCH
    selectors[i]MISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression selectors[i].isSelected(basedir,name,file) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression couldHoldIncluded(arr[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression selectors[i].isSelected(basedir,name,file) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression couldHoldIncluded(arr[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    if (!couldHoldIncluded(arr[i]))
                                                                                                                                          
    3
    scandir(new File(basedir, arr[i]), arr[i] + File.separator, false);
    Preondition Violations
    Unmatched statement scandir(new File(basedir,arr[i]),arr[i] + File.separator,false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    scandir(new File(basedir, arr[i]), arr[i] + File.separator, false);
    4
    return false;
    4
    return false;
    Preondition Violations
    Unmatched return false;
                                    
    Precondition Violations (8)
    Row Violation
    1Type org.apache.tools.ant.types.selectors.FileSelector[] of variable selectors does not match with type java.lang.String[] of variable arr
    2Expression selectors[i].isSelected(basedir,name,file) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression couldHoldIncluded(arr[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression selectors[i].isSelected(basedir,name,file) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression couldHoldIncluded(arr[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Unmatched statement scandir(new File(basedir,arr[i]),arr[i] + File.separator,false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched return false;
    8Clone fragment #1 returns variables , while Clone fragment #2 returns variables i