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; case '_': break; default: state = SCOMPLETE; break states; } }
switch(ival = bytes[i++]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': expSpec = (int)ival-(int)'0'; 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: 20 Number of AST nodes: 16
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
                        
6
                        lastValidOffset = offset;
7
                        break;
8
                    case '_':
9
                        break;
5
expSpec = (int)ival-(int)'0';
6
                        break; //switch
10
                    default:
7
                    default:
11
                        state = SCOMPLETE;
8
                        state = SERR_NOT_STRICT;
12
                        break states;
9
                        break states;
13
                    }
10
                    }
14
                }
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.5
Clones locationClones are in the same method
Number of node comparisons142
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements16
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)10.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    579
    switch (ival = bytes[i++])
    407
    switch (ival = bytes[i++])
    580
    case '0':
    408
    case '0':
    581
    case '1':
    409
    case '1':
    582
    case '2':
    410
    case '2':
    583
    case '3':
    411
    case '3':
    584
    case '4':
    412
    case '4':
    585
    case '5':
    413
    case '5':
    586
    case '6':
    414
    case '6':
    587
    case '7':
    415
    case '7':
    588
    case '8':
    416
    case '8':
    589
    case '9':
    417
    case '9':
    590
    chars[offset++] = (char)ival;
    590
    chars[offset++] = (char)ival;
    Preondition Violations
    Unmatched statement chars[offset++]=(char)ival; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                    
    591
    lastValidOffset = offset;
    591
    lastValidOffset = offset;
    418
    expSpec = (int)ival - (int)'0';
    Differences
    Expression1Expression2Difference
    lastValidOffsetexpSpecVARIABLE_NAME_MISMATCH
    offset(int)ival - (int)'0'TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression (int)ival - (int)'0' cannot be parameterized, because it has dependencies to/from statements that will be extracted
    418
    expSpec = (int)ival - (int)'0';
    592
    break;
    419
    break;
    593
    case '_':
                                
    594
    break;
    594
    break;
    Preondition Violations
    Unmatched break;
                          
    595
    default:
    420
    default:
    596
    state = SCOMPLETE;
    596
    state = SCOMPLETE;
    421
    state = SERR_NOT_STRICT;
    Differences
    Expression1Expression2Difference
    SCOMPLETESERR_NOT_STRICTVARIABLE_NAME_MISMATCH
    421
    state = SERR_NOT_STRICT;
    597
    break states;
    422
    break states;
    Precondition Violations (4)
    Row Violation
    1Unmatched statement chars[offset++]=(char)ival; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression (int)ival - (int)'0' cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched break;
    4Clone fragment #1 returns variables i, ival, lastValidOffset , while Clone fragment #2 returns variables i, expSpec