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_STRICT; break states; case 'e': case 'E': state = SEXP_STRICT; break states; case '_': if (i >= buflen || bytes[i] < '0' || bytes[i] > '9') { state = SERR_NOT_STRICT; break states; } break; //switch default: // only whitespace allowed after value for strict for ( --i; i < buflen && isWhitespace(bytes[i]); i++) ; state = i < buflen ? SERR_NOT_STRICT : SCOMPLETE; break states; } // switch }
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: 32 Number of AST nodes: 22
1
for ( ; i < buflen ; ) {
1
if (i < buflen) {
2
                    switch(ival = bytes[i++]) {
2
                    switch(ival = bytes[i++]) {
3
                    case '0':
3
                    case '0':
4
                        // ignore leading zeroes
5
                        break; // switch
4
 case '1': case '2': case '3': case '4':
6
                    case '1': case '2': case '3': case '4':
5
                    case '5': case '6': case '7': case '8': case '9':
7
                    case '5': case '6': case '7': case '8': case '9':
6
                        chars[offset++] = (char)ival;
8
                        chars[offset++] = (char)ival;
7
                        lastValidOffset = offset;
9
                        lastValidOffset = offset;
8
                        break; // switch
10
                        break; // switch
9
                    case '.':
11
                    case '.':
10
                        state = SDECDIGIT_STRICT;
12
                        state = SDECDIGIT;
11
                        break states;
13
                        break states;
12
                    case 'e':
14
                    
13
                    case 'E':
14
                        state = SEXP_STRICT;
15
                        break states;
16
                    case '_':
17
                        if (i >= buflen || bytes[i] < '0' || bytes[i] > '9') {
18
                            state = SERR_NOT_STRICT;
19
                            break states;
20
                        }
21
                        break; //switch
22
                    default:
23
                        // only whitespace allowed after value for strict
24
                        for ( --i; i < buflen && isWhitespace(bytes[i]);  i++) ;
25
                        state = i < buflen ? SERR_NOT_STRICT :
15
default:
26
 SCOMPLETE; 
16
                        state = SCOMPLETE;
27
                        break states;
17
                        break states;
28
                    } // switch
18
                    } // switch
29
                }
19
                }
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are in the same method
Number of node comparisons2