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; }
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 }
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: 21 Number of AST nodes: 22
1
if (i < buflen) {
1
switch(ival = bytes[i++]) {
2
                    switch(ival = bytes[i++]) {
2
                    case '0':
3
                    case '0':
3
                        // ignore leading zeroes
4
                        // ignore leading zeroes
4
                        break; // switch
5
                        break; // switch
5
                    case '1': case '2': case '3': case '4':
6
                    case '1': case '2': case '3': case '4':
6
                    case '5': case '6': case '7': case '8': case '9':
7
                    case '5': case '6': case '7': case '8': case '9':
7
                        chars[offset++] = (char)ival;
8
                        chars[offset++] = (char)ival;
8
                        lastValidOffset = offset;
9
                        lastValidOffset = offset;
9
                        break; // switch
10
                        break; // switch
10
                    case '.':
11
                    case '.':
11
                        state = SDECDIGIT_STRICT;
12
                        state = SDECDIGIT;
12
                        break states;
13
                        break states;
13
                    default:
14
                    default:
14
                        state = SERR_NOT_STRICT;
15
                        state = SCOMPLETE;
15
                        break states;
16
                        break states;
16
                    }
17
                    } // switch
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 comparisons226
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements21
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)21.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    602
    switch (ival = bytes[i++])
    466
    switch (ival = bytes[i++])
    603
    case '0':
    467
    case '0':
    604
    break;
    468
    break;
    605
    case '1':
    469
    case '1':
    606
    case '2':
    470
    case '2':
    607
    case '3':
    471
    case '3':
    608
    case '4':
    472
    case '4':
    609
    case '5':
    473
    case '5':
    610
    case '6':
    474
    case '6':
    611
    case '7':
    475
    case '7':
    612
    case '8':
    476
    case '8':
    613
    case '9':
    477
    case '9':
    614
    chars[offset++] = (char)ival;
    478
    chars[offset++] = (char)ival;
    615
    lastValidOffset = offset;
    479
    lastValidOffset = offset;
    616
    break;
    480
    break;
    617
    case '.':
    481
    case '.':
    618
    state = SDECDIGIT_STRICT;
    618
    state = SDECDIGIT_STRICT;
    482
    state = SDECDIGIT;
    Differences
    Expression1Expression2Difference
    SDECDIGIT_STRICTSDECDIGITVARIABLE_NAME_MISMATCH
    482
    state = SDECDIGIT;
    619
    break states;
    483
    break states;
    620
    default:
    484
    default:
    621
    state = SERR_NOT_STRICT;
    621
    state = SERR_NOT_STRICT;
    485
    state = SCOMPLETE;
    Differences
    Expression1Expression2Difference
    SERR_NOT_STRICTSCOMPLETEVARIABLE_NAME_MISMATCH
    485
    state = SCOMPLETE;
    622
    break states;
    486
    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