for (int i = 0; i < selectors.length; i++) { if (!selectors[i].isSelected(basedir, name, file)) { return false; } }
for (int counter = 0; counter < excludes.length; counter++) { if (excludes[counter].equals(soughtexclude)) { return 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: boolean isMorePowerfulThanExcludes(String, String)
Number of AST nodes: 3 Number of AST nodes: 3
1
for (int i = 0; i < selectors.length; i++) {
1
for (int counter = 0; counter < excludes.length; counter++) {
2
                if (!selectors[i].isSelected(basedir, name, file)) {
2
            if (excludes[counter].equals(soughtexclude))  {
3
                    return false;
3
                return false;
4
                }
4
            
5
    
5
}
6
        }
6
        }
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 statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.5
    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++)
    2
    for (int counter = 0; counter < excludes.length; counter++)
    Differences
    Expression1Expression2Difference
    icounterVARIABLE_NAME_MISMATCH
    icounterVARIABLE_NAME_MISMATCH
    selectorsexcludesVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.types.selectors.FileSelector[]java.lang.String[]VARIABLE_TYPE_MISMATCH
    icounterVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.types.selectors.FileSelector[] of variable selectors does not match with type java.lang.String[] of variable excludes
    • Make classes org.apache.tools.ant.types.selectors.FileSelector[] and java.lang.String[] extend a common superclass
    2
    for (int counter = 0; counter < excludes.length; counter++)
    3
    if (!selectors[i].isSelected(basedir, name, file))
    3
    if (!selectors[i].isSelected(basedir, name, file))
    3
    if (excludes[counter].equals(soughtexclude))
    Differences
    Expression1Expression2Difference
    !selectors[i].isSelected(basedir,name,file)excludes[counter].equals(soughtexclude)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression !selectors[i].isSelected(basedir,name,file) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression excludes[counter].equals(soughtexclude) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    if (excludes[counter].equals(soughtexclude))
    4
    return false;
    4
    return false;
    Precondition Violations (3)
    Row Violation
    1Type org.apache.tools.ant.types.selectors.FileSelector[] of variable selectors does not match with type java.lang.String[] of variable excludes
    2Expression !selectors[i].isSelected(basedir,name,file) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression excludes[counter].equals(soughtexclude) cannot be parameterized, because it has dependencies to/from statements that will be extracted