if (flags.indexOf('g') != -1) { options |= Regexp.REPLACE_ALL; } if (flags.indexOf('i') != -1) { options |= Regexp.MATCH_CASE_INSENSITIVE; } if (flags.indexOf('m') != -1) { options |= Regexp.MATCH_MULTILINE; }
if (flags.indexOf('i') != -1) { options |= Regexp.MATCH_CASE_INSENSITIVE; } if (flags.indexOf('m') != -1) { options |= Regexp.MATCH_MULTILINE; } if (flags.indexOf('s') != -1) { options |= Regexp.MATCH_SINGLELINE; }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/filters/TokenFilter.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
Method name: int convertRegexOptions(String) Method name: void execute()
Number of AST nodes: 6 Number of AST nodes: 6
1
if (flags.indexOf('g') != -1) {
1
if (flags.indexOf('i') != -1) {
2
            options |= Regexp.REPLACE_ALL;
2
            options |= Regexp.MATCH_CASE_INSENSITIVE;
3
        }
3
        }
4
        if (flags.indexOf('i') != -1) {
4
        if (flags.indexOf('m') != -1) {
5
            options |= Regexp.MATCH_CASE_INSENSITIVE;
5
            options |= Regexp.MATCH_MULTILINE;
6
        }
6
        }
7
        if (flags.indexOf('m') != -1) {
7
        if (flags.indexOf('s') != -1) {
8
            options |= Regexp.MATCH_MULTILINE;
8
            options |= Regexp.MATCH_SINGLELINE;
9
        }
9
        }
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)1.1
Clones locationClones are in different classes
Number of node comparisons27
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    if (flags.indexOf('g') != -1)
    4
    if (flags.indexOf('g') != -1)
    10
    if (flags.indexOf('i') != -1)
    Differences
    Expression1Expression2Difference
    'g''i'LITERAL_VALUE_MISMATCH
    10
    if (flags.indexOf('i') != -1)
    5
    options |= Regexp.REPLACE_ALL;
    5
    options |= Regexp.REPLACE_ALL;
    11
    options |= Regexp.MATCH_CASE_INSENSITIVE;
    Differences
    Expression1Expression2Difference
    REPLACE_ALLMATCH_CASE_INSENSITIVEVARIABLE_NAME_MISMATCH
    11
    options |= Regexp.MATCH_CASE_INSENSITIVE;
    6
    if (flags.indexOf('i') != -1)
    6
    if (flags.indexOf('i') != -1)
    12
    if (flags.indexOf('m') != -1)
    Differences
    Expression1Expression2Difference
    'i''m'LITERAL_VALUE_MISMATCH
    12
    if (flags.indexOf('m') != -1)
    7
    options |= Regexp.MATCH_CASE_INSENSITIVE;
    7
    options |= Regexp.MATCH_CASE_INSENSITIVE;
    13
    options |= Regexp.MATCH_MULTILINE;
    Differences
    Expression1Expression2Difference
    MATCH_CASE_INSENSITIVEMATCH_MULTILINEVARIABLE_NAME_MISMATCH
    13
    options |= Regexp.MATCH_MULTILINE;
    8
    if (flags.indexOf('m') != -1)
    8
    if (flags.indexOf('m') != -1)
    14
    if (flags.indexOf('s') != -1)
    Differences
    Expression1Expression2Difference
    'm''s'LITERAL_VALUE_MISMATCH
    14
    if (flags.indexOf('s') != -1)
    9
    options |= Regexp.MATCH_MULTILINE;
    9
    options |= Regexp.MATCH_MULTILINE;
    15
    options |= Regexp.MATCH_SINGLELINE;
    Differences
    Expression1Expression2Difference
    MATCH_MULTILINEMATCH_SINGLELINEVARIABLE_NAME_MISMATCH
    15
    options |= Regexp.MATCH_SINGLELINE;
    Precondition Violations (1)
    Row Violation
    1The refactoring of the clones is infeasible, because classes org.apache.tools.ant.filters.TokenFilter and org.apache.tools.ant.taskdefs.optional.ReplaceRegExp do not have a common superclass