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 }
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_STRICT; break states; 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: 24 Number of AST nodes: 21
1
for ( ; i < buflen ; ) {
2
                    switch(ival = bytes[i++]) {
1
switch(ival = bytes[i++]) {
3
                    case '0':
2
                    case '0':
3
                        // ignore leading zeroes
4
                        break; // switch
4
 case '1': case '2': case '3': case '4':
5
                    case '1': case '2': case '3': case '4':
5
                    case '5': case '6': case '7': case '8': case '9':
6
                    case '5': case '6': case '7': case '8': case '9':
6
                        chars[offset++] = (char)ival;
7
                        chars[offset++] = (char)ival;
7
                        lastValidOffset = offset;
8
                        lastValidOffset = offset;
8
                        break; // switch
9
                        break; // switch
9
                    case 'e':
10
                    case '
10
                    case 'E':
11
.':
11
                        state = SEXP;
12
                        state = SDECDIGIT_STRICT;
12
                        break states;
13
                        break states;
13
                    case '_':
14
                        break; // switch
15
                    default:
14
                    default:
16
                        state = SCOMPLETE;
15
                        state = SERR_NOT_STRICT;
17
                        break states;
16
                        break states;
18
                    } // switch
17
                    }
19
                }
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.4
Clones locationClones are in the same method
Number of node comparisons218
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements21
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)17.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    539
    switch (ival = bytes[i++])
    602
    switch (ival = bytes[i++])
    540
    case '0':
    603
    case '0':
    541
    case '1':
    605
    case '1':
    542
    case '2':
    606
    case '2':
    543
    case '3':
    607
    case '3':
    544
    case '4':
    608
    case '4':
    545
    case '5':
    609
    case '5':
    546
    case '6':
    610
    case '6':
    547
    case '7':
    611
    case '7':
    548
    case '8':
    612
    case '8':
    549
    case '9':
    613
    case '9':
    550
    chars[offset++] = (char)ival;
    614
    chars[offset++] = (char)ival;
    551
    lastValidOffset = offset;
    615
    lastValidOffset = offset;
    552
    break;
    616
    break;
    553
    case 'e':
    553
    case 'e':
    617
    case '.':
    Differences
    Expression1Expression2Difference
    'e''.'LITERAL_VALUE_MISMATCH
    617
    case '.':
    554
    case 'E':
                                
    555
    state = SEXP;
    555
    state = SEXP;
    621
    state = SERR_NOT_STRICT;
    Differences
    Expression1Expression2Difference
    SEXPSERR_NOT_STRICTVARIABLE_NAME_MISMATCH
    621
    state = SERR_NOT_STRICT;
    556
    break states;
    622
    break states;
    557
    case '_':
                                
    558
    break;
    604
    break;
    559
    default:
    620
    default:
    560
    state = SCOMPLETE;
    560
    state = SCOMPLETE;
    618
    state = SDECDIGIT_STRICT;
    Differences
    Expression1Expression2Difference
    SCOMPLETESDECDIGIT_STRICTVARIABLE_NAME_MISMATCH
    618
    state = SDECDIGIT_STRICT;
    561
    break states;
    619
    break states;
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables i, ival, offset, chars, lastValidOffset , while Clone fragment #2 returns variables i, ival, offset, chars, lastValidOffset