for ( ; i < buflen ; ) { 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 case '.': state = SDECDIGIT; break states; case 'e': case 'E': state = SEXP; break states; case '_': break; // switch default: state = SCOMPLETE; break states; } // switch }
for ( ; i < buflen ; ) { 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 case 'e': case 'E': state = SEXP; break states; case '_': break; // switch default: state = SCOMPLETE; break states; } // switch }
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: 27 Number of AST nodes: 24
1
for ( ; i < buflen ; ) {
1
for ( ; i < buflen ; ) {
2
                    switch(ival = bytes[i++]) {
2
                    switch(ival = bytes[i++]) {
3
                    case '0': case '1': case '2': case '3': case '4':
3
                    case '0': case '1': case '2': case '3': case '4':
4
                    case '5': case '6': case '7': case '8': case '9':
4
                    case '5': case '6': case '7': case '8': case '9':
5
                        chars[offset++] = (char)ival;
5
                        chars[offset++] = (char)ival;
6
                        lastValidOffset = offset;
6
                        lastValidOffset = offset;
7
                        break; // switch
7
                        break; // switch
8
                    case '.':
9
                        state = SDECDIGIT;
10
                        break states;
11
                    case 'e':
8
                    case 'e':
12
                    case 'E':
9
                    case 'E':
13
                        state = SEXP;
10
                        state = SEXP;
14
                        break states;
11
                        break states;
15
                    case '_':
12
                    case '_':
16
                        break; // switch
13
                        break; // switch
17
                    default:
14
                    default:
18
                        state = SCOMPLETE;
15
                        state = SCOMPLETE;
19
                        break states;
16
                        break states;
20
                    } // switch
17
                    } // switch
21
                }
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.8
Clones locationClones are in the same method
Number of node comparisons275
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements24
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)19.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    487
    for (; i < buflen; )
    538
    for (; i < buflen; )
    488
    switch (ival = bytes[i++])
    539
    switch (ival = bytes[i++])
    489
    case '0':
    540
    case '0':
    490
    case '1':
    541
    case '1':
    491
    case '2':
    542
    case '2':
    492
    case '3':
    543
    case '3':
    493
    case '4':
    544
    case '4':
    494
    case '5':
    545
    case '5':
    495
    case '6':
    546
    case '6':
    496
    case '7':
    547
    case '7':
    497
    case '8':
    548
    case '8':
    498
    case '9':
    549
    case '9':
    499
    chars[offset++] = (char)ival;
    550
    chars[offset++] = (char)ival;
    500
    lastValidOffset = offset;
    551
    lastValidOffset = offset;
    501
    break;
    552
    break;
    502
    case '.':
    502
    case '.':
    554
    case 'E':
    Differences
    Expression1Expression2Difference
    '.''E'LITERAL_VALUE_MISMATCH
    554
    case 'E':
    503
    state = SDECDIGIT;
    503
    state = SDECDIGIT;
    555
    state = SEXP;
    Differences
    Expression1Expression2Difference
    SDECDIGITSEXPVARIABLE_NAME_MISMATCH
    555
    state = SEXP;
    504
    break states;
    556
    break states;
    505
    case 'e':
    553
    case 'e':
    506
    case 'E':
                                
    507
    state = SEXP;
    507
    state = SEXP;
    560
    state = SCOMPLETE;
    Differences
    Expression1Expression2Difference
    SEXPSCOMPLETEVARIABLE_NAME_MISMATCH
    560
    state = SCOMPLETE;
    508
    break states;
    561
    break states;
    509
    case '_':
    557
    case '_':
    510
    break;
    558
    break;
    511
    default:
    559
    default:
    512
    state = SCOMPLETE;
    512
    state = SCOMPLETE;
    Preondition Violations
    Unmatched statement state=SCOMPLETE; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                              
    513
    break states;
    513
    break states;
    Preondition Violations
    Unmatched break states;
                                        
    Precondition Violations (3)
    Row Violation
    1Unmatched statement state=SCOMPLETE; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched break states;
    3Clone fragment #1 returns variables i, ival, offset, chars, lastValidOffset , while Clone fragment #2 returns variables i, ival, offset, chars, lastValidOffset