do { if (bytes[p] == 'm') { options &= ~RE_OPTION_MULTILINE; } else if (bytes[p] == 'i') { options &= ~RE_OPTION_IGNORECASE; } else if (bytes[p] == 'x') { options &= ~RE_OPTION_EXTENDED; } else { break; } p++; } while (--len > 0);
do { if (bytes[p] == 'm') { options |= RE_OPTION_MULTILINE; } else if (bytes[p] == 'i') { options |= RE_OPTION_IGNORECASE; } else if (bytes[p] == 'x') { options |= RE_OPTION_EXTENDED; } else { break; } p++; } while (--len > 0);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyRegexp.java File path: /jruby-1.4.0/src/org/jruby/RubyRegexp.java
Method name: IRubyObject to_s() Method name: IRubyObject to_s()
Number of AST nodes: 9 Number of AST nodes: 9
1
do {
1
do {
2
                        if (bytes[p] == 'm') {
2
                        if (bytes[p] == 'm') {
3
                            options &= ~RE_OPTION_MULTILINE;
3
                            options |= RE_OPTION_MULTILINE;
4
                        } else if (bytes[p] == 'i') {
4
                        } else if (bytes[p] == 'i') {
5
                            options &= ~RE_OPTION_IGNORECASE;
5
                            options |= RE_OPTION_IGNORECASE;
6
                        } else if (bytes[p] == 'x') {
6
                        } else if (bytes[p] == 'x') {
7
                            options &= ~RE_OPTION_EXTENDED;
7
                            options |= RE_OPTION_EXTENDED;
8
                        } else {
8
                        } else {
9
                            break;
9
                            break;
10
                        }
10
                        }
11
                        p++;
11
                        p++;
12
                    } while (--len > 0);
12
                    } while (--len > 0);
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.2
Clones locationClones are in the same method
Number of node comparisons45
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    32
    do while(--len > 0)
    20
    do while(--len > 0)
    24
    if (bytes[p] == 'm')
    12
    if (bytes[p] == 'm')
                                                                      
    13
    options |= RE_OPTION_MULTILINE;
    Preondition Violations
    Unmatched statement options|=RE_OPTION_MULTILINE; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13
    options |= RE_OPTION_MULTILINE;
    25
    options &= ~RE_OPTION_MULTILINE;
    25
    options &= ~RE_OPTION_MULTILINE;
    Preondition Violations
    Unmatched statement options&=~RE_OPTION_MULTILINE; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                        
    26
    else if (bytes[p] == 'i')
    14
    else if (bytes[p] == 'i')
                                                                        
    15
    options |= RE_OPTION_IGNORECASE;
    Preondition Violations
    Unmatched statement options|=RE_OPTION_IGNORECASE; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    15
    options |= RE_OPTION_IGNORECASE;
    27
    options &= ~RE_OPTION_IGNORECASE;
    27
    options &= ~RE_OPTION_IGNORECASE;
    Preondition Violations
    Unmatched statement options&=~RE_OPTION_IGNORECASE; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                          
    28
    else if (bytes[p] == 'x')
    16
    else if (bytes[p] == 'x')
                                                                    
    17
    options |= RE_OPTION_EXTENDED;
    Preondition Violations
    Unmatched statement options|=RE_OPTION_EXTENDED; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    17
    options |= RE_OPTION_EXTENDED;
    29
    options &= ~RE_OPTION_EXTENDED;
    29
    options &= ~RE_OPTION_EXTENDED;
    Preondition Violations
    Unmatched statement options&=~RE_OPTION_EXTENDED; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                      
    else
    else
    30
    break;
    18
    break;
    31
    p++;
    19
    p++;
    Precondition Violations (7)
    Row Violation
    1Unmatched statement options|=RE_OPTION_MULTILINE; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement options&=~RE_OPTION_MULTILINE; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement options|=RE_OPTION_IGNORECASE; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement options&=~RE_OPTION_IGNORECASE; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement options|=RE_OPTION_EXTENDED; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement options&=~RE_OPTION_EXTENDED; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Clone fragment #1 returns variables len, p , while Clone fragment #2 returns variables len, p