if (i < buflen) { switch(ival = bytes[i++]) { case '0': // ignore leading zeroes break; // switch case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': chars[offset++] = (char)ival; lastValidOffset = offset; break; // switch case '.': state = SDECDIGIT; break states; default: state = SCOMPLETE; break states; } // switch }
switch(ival = bytes[i++]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': chars[offset++] = (char)ival; lastValidOffset = offset; break; // switch default: state = SERR_NOT_STRICT; break states; }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/util/Convert.java File path: /jruby-1.4.0/src/org/jruby/util/Convert.java
Method name: double byteArrayToDouble(byte[], int, int, boolean) Method name: double byteArrayToDouble(byte[], int, int, boolean)
Number of AST nodes: 22 Number of AST nodes: 17
1
if (i < buflen) {
2
                    switch(ival = bytes[i++]) {
1
switch(ival = bytes[i++]) {
3
                    case '0':
2
                    case '0':
4
                        // ignore leading zeroes
5
                        break; // switch
6
                    case '1': case '2': case '3': case '4':
3
 case '1': case '2': case '3': case '4':
7
                    case '5': case '6': case '7': case '8': case '9':
4
                    case '5': case '6': case '7': case '8': case '9':
8
                        chars[offset++] = (char)ival;
5
                        chars[offset++] = (char)ival;
9
                        lastValidOffset = offset;
6
                        lastValidOffset = offset;
10
                        break; // switch
7
                        break; // switch
11
                    case '.':
12
                        state = SDECDIGIT;
13
                        break states;
14
                    default:
8
                    default:
15
                        state = SCOMPLETE;
9
                        state = SERR_NOT_STRICT;
16
                        break states;
10
                        break states;
17
                    } // switch
11
                    }
18
                }
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.7
Clones locationClones are in the same method
Number of node comparisons145
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements17
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)14.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    466
    switch (ival = bytes[i++])
    662
    switch (ival = bytes[i++])
    467
    case '0':
    467
    case '0':
    672
    case '9':
    Differences
    Expression1Expression2Difference
    '0''9'LITERAL_VALUE_MISMATCH
    672
    case '9':
    468
    break;
    675
    break;
    469
    case '1':
    664
    case '1':
    470
    case '2':
    665
    case '2':
    471
    case '3':
    666
    case '3':
    472
    case '4':
    667
    case '4':
    473
    case '5':
    668
    case '5':
    474
    case '6':
    669
    case '6':
    475
    case '7':
    670
    case '7':
    476
    case '8':
    671
    case '8':
    477
    case '9':
    477
    case '9':
    663
    case '0':
    Differences
    Expression1Expression2Difference
    '9''0'LITERAL_VALUE_MISMATCH
    663
    case '0':
    478
    chars[offset++] = (char)ival;
    673
    chars[offset++] = (char)ival;
    479
    lastValidOffset = offset;
    674
    lastValidOffset = offset;
    480
    break;
    480
    break;
    Preondition Violations
    Unmatched break;
                          
    481
    case '.':
                                
    482
    state = SDECDIGIT;
    482
    state = SDECDIGIT;
    677
    state = SERR_NOT_STRICT;
    Differences
    Expression1Expression2Difference
    SDECDIGITSERR_NOT_STRICTVARIABLE_NAME_MISMATCH
    677
    state = SERR_NOT_STRICT;
    483
    break states;
    678
    break states;
    484
    default:
    676
    default:
    485
    state = SCOMPLETE;
                                              
    486
    break states;
    486
    break states;
    Preondition Violations
    Unmatched break states;
                                        
    Precondition Violations (3)
    Row Violation
    1Unmatched break;
    2Unmatched break states;
    3Clone fragment #1 returns variables i, ival, offset, chars, lastValidOffset , while Clone fragment #2 returns variables i, ival, offset, chars, lastValidOffset