int index = from.lastIndexOf("*"); if (index == -1) { fromPrefix = from; fromPostfix = ""; } else { fromPrefix = from.substring(0, index); fromPostfix = from.substring(index + 1); } prefixLength = fromPrefix.length(); postfixLength = fromPostfix.length();
int index = to.lastIndexOf("*"); if (index == -1) { toPrefix = to; toPostfix = ""; } else { toPrefix = to.substring(0, index); toPostfix = to.substring(index + 1); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/GlobPatternMapper.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/GlobPatternMapper.java
Method name: void setFrom(String) Method name: void setTo(String)
Number of AST nodes: 8 Number of AST nodes: 6
1
int index = from.lastIndexOf("*");
1
int index = to.lastIndexOf("*");
2
        if (index == -1) {
2
        if (index == -1) {
3
            fromPrefix = from;
3
            toPrefix = to;
4
            fromPostfix = "";
4
            toPostfix = "";
5
        } else {
5
        } else {
6
            fromPrefix = from.substring(0, index);
6
            toPrefix = to.substring(0, index);
7
            fromPostfix = from.substring(index + 1);
7
            toPostfix = to.substring(index + 1);
8
        }
8
        }
9
        prefixLength = fromPrefix.length();
10
        postfixLength = fromPostfix.length();
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.2
Clones locationClones are declared in the same class
Number of node comparisons28
  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 fragment0
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    int index = from.lastIndexOf("*");
    1
    int index = from.lastIndexOf("*");
    1
    int index = to.lastIndexOf("*");
    Differences
    Expression1Expression2Difference
    fromtoVARIABLE_NAME_MISMATCH
    1
    int index = to.lastIndexOf("*");
    2
    if (index == -1)
    2
    if (index == -1)
    3
    fromPrefix = from;
    3
    fromPrefix = from;
    3
    toPrefix = to;
    Differences
    Expression1Expression2Difference
    fromPrefixtoPrefixVARIABLE_NAME_MISMATCH
    fromtoVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression fromPrefix is a field being modified, and thus it cannot be parameterized
    Expression toPrefix is a field being modified, and thus it cannot be parameterized
    3
    toPrefix = to;
    4
    fromPostfix = "";
    4
    fromPostfix = "";
    4
    toPostfix = "";
    Differences
    Expression1Expression2Difference
    fromPostfixtoPostfixVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression fromPostfix is a field being modified, and thus it cannot be parameterized
    Expression toPostfix is a field being modified, and thus it cannot be parameterized
    4
    toPostfix = "";
    else
    else
    5
    fromPrefix = from.substring(0, index);
    5
    fromPrefix = from.substring(0, index);
    5
    toPrefix = to.substring(0, index);
    Differences
    Expression1Expression2Difference
    fromPrefixtoPrefixVARIABLE_NAME_MISMATCH
    fromtoVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression fromPrefix is a field being modified, and thus it cannot be parameterized
    Expression toPrefix is a field being modified, and thus it cannot be parameterized
    5
    toPrefix = to.substring(0, index);
    6
    fromPostfix = from.substring(index + 1);
    6
    fromPostfix = from.substring(index + 1);
    6
    toPostfix = to.substring(index + 1);
    Differences
    Expression1Expression2Difference
    fromPostfixtoPostfixVARIABLE_NAME_MISMATCH
    fromtoVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression fromPostfix is a field being modified, and thus it cannot be parameterized
    Expression toPostfix is a field being modified, and thus it cannot be parameterized
    6
    toPostfix = to.substring(index + 1);
    7
    prefixLength = fromPrefix.length();
                                                                            
    8
    postfixLength = fromPostfix.length();
                                                                                
    Precondition Violations (8)
    Row Violation
    1Expression fromPrefix is a field being modified, and thus it cannot be parameterized
    2Expression toPrefix is a field being modified, and thus it cannot be parameterized
    3Expression fromPostfix is a field being modified, and thus it cannot be parameterized
    4Expression toPostfix is a field being modified, and thus it cannot be parameterized
    5Expression fromPrefix is a field being modified, and thus it cannot be parameterized
    6Expression toPrefix is a field being modified, and thus it cannot be parameterized
    7Expression fromPostfix is a field being modified, and thus it cannot be parameterized
    8Expression toPostfix is a field being modified, and thus it cannot be parameterized