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': 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: 24 Number of AST nodes: 17
1
for ( ; i < buflen ; ) {
2
                    switch(ival = bytes[i++]) {
1
switch(ival = bytes[i++]) {
3
                    case '0': case '1': case '2': case '3': case '4':
2
                    case '0': case '1': case '2': case '3': case '4':
4
                    case '5': case '6': case '7': case '8': case '9':
3
                    case '5': case '6': case '7': case '8': case '9':
5
                        chars[offset++] = (char)ival;
4
                        chars[offset++] = (char)ival;
6
                        lastValidOffset = offset;
5
                        lastValidOffset = offset;
7
                        break; // switch
6
                        break; //
8
                    case 'e':
9
                    case 'E':
10
                        state = SEXP;
11
                        break states;
12
                    case '_':
13
                        break; // switch
7
switch
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.4
Clones locationClones are in the same method
Number of node comparisons167
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements17
    Number of unmapped statements in the first code fragment6
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)13.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    539
    switch (ival = bytes[i++])
    725
    switch (ival = bytes[i++])
    540
    case '0':
    726
    case '0':
    541
    case '1':
    727
    case '1':
    542
    case '2':
    728
    case '2':
    543
    case '3':
    729
    case '3':
    544
    case '4':
    730
    case '4':
    545
    case '5':
    731
    case '5':
    546
    case '6':
    732
    case '6':
    547
    case '7':
    733
    case '7':
    548
    case '8':
    734
    case '8':
    549
    case '9':
    735
    case '9':
    550
    chars[offset++] = (char)ival;
    736
    chars[offset++] = (char)ival;
    551
    lastValidOffset = offset;
    737
    lastValidOffset = offset;
    552
    break;
    738
    break;
    553
    case 'e':
                                
    554
    case 'E':
                                
    555
    state = SEXP;
    555
    state = SEXP;
    Preondition Violations
    Unmatched statement state=SEXP; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                    
    556
    break states;
    556
    break states;
    Preondition Violations
    Unmatched break states;
                                        
    557
    case '_':
                                
    558
    break;
    558
    break;
    Preondition Violations
    Unmatched break;
                          
    559
    default:
    739
    default:
    560
    state = SCOMPLETE;
    560
    state = SCOMPLETE;
    740
    state = SERR_NOT_STRICT;
    Differences
    Expression1Expression2Difference
    SCOMPLETESERR_NOT_STRICTVARIABLE_NAME_MISMATCH
    740
    state = SERR_NOT_STRICT;
    561
    break states;
    741
    break states;
    Precondition Violations (4)
    Row Violation
    1Unmatched statement state=SEXP; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched break states;
    3Unmatched break;
    4Clone fragment #1 returns variables i, ival, offset, chars, lastValidOffset , while Clone fragment #2 returns variables i, ival, offset, chars, lastValidOffset