while ((ch = patArr[patIdxEnd]) != '*' && strIdxStart <= strIdxEnd) { if (ch != '?') { if (isCaseSensitive && ch != strArr[strIdxEnd]) { return false; // Character mismatch } if (!isCaseSensitive && Character.toUpperCase(ch) != Character.toUpperCase(strArr[strIdxEnd])) { return false; // Character mismatch } } patIdxEnd--; strIdxEnd--; }
while ((ch = patArr[patIdxStart]) != '*' && strIdxStart <= strIdxEnd) { if (ch != '?') { if (isCaseSensitive && ch != strArr[strIdxStart]) { return false; // Character mismatch } if (!isCaseSensitive && Character.toUpperCase(ch) != Character.toUpperCase(strArr[strIdxStart])) { return false; // Character mismatch } } patIdxStart++; strIdxStart++; }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/SelectorUtils.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/SelectorUtils.java
Method name: boolean match(String, String, boolean) Method name: boolean match(String, String, boolean)
Number of AST nodes: 8 Number of AST nodes: 8
1
while ((ch = patArr[patIdxEnd]) != '*' && strIdxStart <= strIdxEnd) {
1
while ((ch = patArr[patIdxStart]) != '*' && strIdxStart <= strIdxEnd) {
2
            if (ch != '?') {
2
            if (ch != '?') {
3
                if (isCaseSensitive && ch != strArr[strIdxEnd]) {
3
                if (isCaseSensitive && ch != strArr[strIdxStart]) {
4
                    return false; // Character mismatch
4
                    return false; // Character mismatch
5
                }
5
                }
6
                if (!isCaseSensitive && Character.toUpperCase(ch)
6
                if (!isCaseSensitive && Character.toUpperCase(ch)
7
                        != Character.toUpperCase(strArr[strIdxEnd])) {
7
                        != Character.toUpperCase(strArr[strIdxStart])) {
8
                    return false; // Character mismatch
8
                    return false; // Character mismatch
9
                }
9
                }
10
            }
10
            }
11
            patIdxEnd--;
11
            patIdxStart++;
12
            strIdxEnd--;
12
            strIdxStart++;
13
        }
13
        }
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.9
Clones locationClones are in the same method
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    39
    while ((ch = patArr[patIdxEnd]) != '*' && strIdxStart <= strIdxEnd)
    39
    while ((ch = patArr[patIdxEnd]) != '*' && strIdxStart <= strIdxEnd)
    26
    while ((ch = patArr[patIdxStart]) != '*' && strIdxStart <= strIdxEnd)
    Differences
    Expression1Expression2Difference
    patIdxEndpatIdxStartVARIABLE_NAME_MISMATCH
    26
    while ((ch = patArr[patIdxStart]) != '*' && strIdxStart <= strIdxEnd)
    40
    if (ch != '?')
    27
    if (ch != '?')
    41
    if (isCaseSensitive && ch != strArr[strIdxEnd])
    41
    if (isCaseSensitive && ch != strArr[strIdxEnd])
    28
    if (isCaseSensitive && ch != strArr[strIdxStart])
    Differences
    Expression1Expression2Difference
    strIdxEndstrIdxStartVARIABLE_NAME_MISMATCH
    28
    if (isCaseSensitive && ch != strArr[strIdxStart])
    42
    return false;
    42
    return false;
    29
    return false;
    Preondition Violations
    Conditional return false;
    Conditional return false;
    29
    return false;
    43
    if (!isCaseSensitive && Character.toUpperCase(ch) != Character.toUpperCase(strArr[strIdxEnd]))
    43
    if (!isCaseSensitive && Character.toUpperCase(ch) != Character.toUpperCase(strArr[strIdxEnd]))
    30
    if (!isCaseSensitive && Character.toUpperCase(ch) != Character.toUpperCase(strArr[strIdxStart]))
    Differences
    Expression1Expression2Difference
    strIdxEndstrIdxStartVARIABLE_NAME_MISMATCH
    30
    if (!isCaseSensitive && Character.toUpperCase(ch) != Character.toUpperCase(strArr[strIdxStart]))
    44
    return false;
    44
    return false;
    31
    return false;
    Preondition Violations
    Conditional return false;
    Conditional return false;
    31
    return false;
                                        
    32
    patIdxStart++;
    Preondition Violations
    Unmatched statement patIdxStart++; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    32
    patIdxStart++;
                                        
    33
    strIdxStart++;
    Preondition Violations
    Unmatched statement strIdxStart++; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    33
    strIdxStart++;
    45
    patIdxEnd--;
    45
    patIdxEnd--;
    Preondition Violations
    Unmatched statement patIdxEnd--; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                    
    46
    strIdxEnd--;
    46
    strIdxEnd--;
    Preondition Violations
    Unmatched statement strIdxEnd--; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                    
    Precondition Violations (8)
    Row Violation
    1Unmatched statement patIdxStart++; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement strIdxStart++; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement patIdxEnd--; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement strIdxEnd--; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Conditional return false;
    6Conditional return false;
    7Conditional return false;
    8Conditional return false;