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: 39 | Number of AST nodes: 28 | |||
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 | if (nDigits > 0) {↵ | 4 | if (nDigits > 0) {↵ | |
5 | nTrailingZeroes++;↵ | 5 | nTrailingZeroes++;↵ | |
6 | } else {↵ | 6 | } else {↵ | |
7 | exponent--;↵ | 7 | exponent--;↵ | |
8 | }↵ | 8 | }↵ | |
9 | break; // switch↵ | 9 | break; // switch↵ | |
10 | case '1': case '2': case '3': case '4':↵ | 10 | case '1': case '2': case '3': case '4':↵ | |
11 | case '5': case '6': case '7': case '8': case '9':↵ | 11 | case '5': case '6': case '7': case '8': case '9':↵ | |
12 | if (nTrailingZeroes > 0) {↵ | 12 | if (nTrailingZeroes > 0) {↵ | |
13 | if ((nDigits += nTrailingZeroes) < MAX_DECIMAL_DIGITS) {↵ | 13 | if ((nDigits += nTrailingZeroes) < MAX_DECIMAL_DIGITS) {↵ | |
14 | significand *= LONG_10_POWERS[nTrailingZeroes];↵ | 14 | significand *= LONG_10_POWERS[nTrailingZeroes];↵ | |
15 | nTrailingZeroes = 0;↵ | 15 | nTrailingZeroes = 0;↵ | |
16 | } // else catch oversize below↵ | 16 | } // else catch oversize below↵ | |
17 | }↵ | 17 | }↵ | |
18 | if (nDigits++ < MAX_DECIMAL_DIGITS) {↵ | 18 | if (nDigits++ < MAX_DECIMAL_DIGITS) {↵ | |
19 | significand = significand*10L + (long)((int)ival-(int)'0');↵ | 19 | significand = significand*10L + (long)((int)ival-(int)'0');↵ | |
20 | break; // switch↵ | 20 | break; // switch↵ | |
21 | } else {↵ | 21 | } else {↵ | |
22 | state = SDIGIT;↵ | 22 | state = SDIGIT;↵ | |
23 | break states;↵ | 23 | break states;↵ | |
24 | }↵ | 24 | }↵ | |
25 | case 'e':↵ | 25 | ↵ | |
26 | case 'E':↵ | |||
27 | state = SOPTEXP_STRICT;↵ | |||
28 | break states;↵ | |||
29 | case '_':↵ | |||
30 | if (i >= buflen || bytes[i] < '0' || bytes[i] > '9') {↵ | |||
31 | ↵ | 26 | default:↵ | |
27 | // no dec digits, end of parseable data, go to calc↵ | |||
32 | state = SERR_NOT_STRICT;↵ | 28 | state = S↵ | |
33 | ↵ | 29 | OPTCALC;↵ | |
34 | break states;↵ | 30 | break states;↵ | |
35 | }↵ | 31 | ↵ | |
36 | break; // switch↵ | |||
37 | default:↵ | |||
38 | // only whitespace allowed after value for strict↵ | |||
39 | for ( --i; i < buflen && isWhitespace(bytes[i]); i++);↵ | |||
40 | state = i < buflen ? SERR_NOT_STRICT : SOPTCALC; ↵ | |||
41 | break states;↵ | |||
42 | } // switch↵ | 32 | } // switch↵ | |
43 | } | 33 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 3.7 |
Clones location | Clones are in the same method |
Number of node comparisons | 195 |
Number of mapped statements | 27 |
Number of unmapped statements in the first code fragment | 11 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 50.6 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
353 | switch (ival = bytes[i++]) | 127 | switch (ival = bytes[i++]) | |||||||||||
354 | case '0': | 128 | case '0': | |||||||||||
355 | if (nDigits > 0) | 129 | if (nDigits > 0) | |||||||||||
356 | nTrailingZeroes++; | 130 | nTrailingZeroes++; | |||||||||||
else | else | |||||||||||||
357 | exponent--; | 131 | exponent--; | |||||||||||
358 | break; | 132 | break; | |||||||||||
359 | case '1': | 133 | case '1': | |||||||||||
360 | case '2': | 134 | case '2': | |||||||||||
361 | case '3': | 135 | case '3': | |||||||||||
362 | case '4': | 136 | case '4': | |||||||||||
363 | case '5': | 137 | case '5': | |||||||||||
364 | case '6': | 138 | case '6': | |||||||||||
365 | case '7': | 139 | case '7': | |||||||||||
366 | case '8': | 140 | case '8': | |||||||||||
367 | case '9': | 141 | case '9': | |||||||||||
368 | if (nTrailingZeroes > 0) | 142 | if (nTrailingZeroes > 0) | |||||||||||
369 | if ((nDigits += nTrailingZeroes) < MAX_DECIMAL_DIGITS) | 143 | if ((nDigits += nTrailingZeroes) < MAX_DECIMAL_DIGITS) | |||||||||||
370 | significand *= LONG_10_POWERS[nTrailingZeroes]; | 144 | significand *= LONG_10_POWERS[nTrailingZeroes]; | |||||||||||
371 | nTrailingZeroes = 0; | 145 | nTrailingZeroes = 0; | |||||||||||
372 | if (nDigits++ < MAX_DECIMAL_DIGITS) | 146 | if (nDigits++ < MAX_DECIMAL_DIGITS) | |||||||||||
373 | significand = significand * 10L + (long)((int)ival - (int)'0'); | 147 | significand = significand * 10L + (long)((int)ival - (int)'0'); | |||||||||||
374 | break; | 148 | break; | |||||||||||
else | else | |||||||||||||
375 | state = SDIGIT; | 149 | state = SDIGIT; | |||||||||||
376 | break states; | 150 | break states; | |||||||||||
377 | case 'e': | | ||||||||||||
378 | case 'E': | | ||||||||||||
379 | state = SOPTEXP_STRICT; |
| 152 | state = SOPTCALC; | ||||||||||
380 | break states; |
| | |||||||||||
381 | case '_': | | ||||||||||||
382 | if (i >= buflen || bytes[i] < '0' || bytes[i] > '9') |
| | |||||||||||
383 | state = SERR_NOT_STRICT; |
| | |||||||||||
384 | break states; |
| | |||||||||||
385 | break; |
| | |||||||||||
386 | default: | 151 | default: | |||||||||||
387 | for (--i; i < buflen && isWhitespace(bytes[i]); i++) |
| | |||||||||||
388 | ; | | ||||||||||||
389 | state = i < buflen ? SERR_NOT_STRICT : SOPTCALC; |
| | |||||||||||
390 | break states; | 153 | break states; |
Row | Violation |
---|---|
1 | Unmatched break states; |
2 | Unmatched statement if(i >= buflen || bytes[i] < '0' || bytes[i] > '9') cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement state=SERR_NOT_STRICT; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched break states; |
5 | Unmatched break; |
6 | Unmatched statement for(--i; i < buflen && isWhitespace(bytes[i]); i++) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
7 | Unmatched statement state=i < buflen ? SERR_NOT_STRICT : SOPTCALC; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
8 | Clone fragment #1 returns variables i, ival, nDigits, nTrailingZeroes, significand, exponent , while Clone fragment #2 returns variables i, ival, nDigits, nTrailingZeroes, significand, exponent |