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;
break states;
case 'e':
case 'E':
state = SEXP;
break states;
case '_':
break; // switch
default:
state = 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: 27
|
|
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;↵ | | 12 | state = SDECDIGIT;↵
|
11 | break states;↵ | | 13 | break states;↵
|
12 | case 'e':↵ | | |
|
13 | case 'E':↵ | | |
|
14 | state = SEXP;↵ | | |
|
15 | break states;↵ | | |
|
16 | case '_':↵ | | |
|
17 | break; // switch↵ | | |
|
18 | default:↵ | | 14 | default:↵
|
19 | state = SCOMPLETE;↵ | | 15 | state = SCOMPLETE;↵
|
20 | break states;↵ | | 16 | break states;↵
|
21 | } // switch↵ | | 17 | } // switch↵
|
22 | } | | 18 | }
|
See real code fragment |
|
See real code fragment |
Summary
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) | 0.5 |
Clones location | Clones are in the same method |
Number of node comparisons | 234 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 21 |
Number of unmapped statements in the first code fragment | 5 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 24.4 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
488 | switch (ival = bytes[i++]) | | 466 | switch (ival = bytes[i++]) |
489 | | | 467 | |
490 | | | 469 | |
491 | | | 470 | |
492 | | | 471 | |
493 | | | 472 | |
494 | | | 473 | |
495 | | | 474 | |
496 | | | 475 | |
497 | | | 476 | |
498 | | | 477 | |
499 | chars[offset++] = (char)ival; | | 478 | chars[offset++] = (char)ival; |
500 | lastValidOffset = offset; | | 479 | lastValidOffset = offset; |
501 | | | 480 | |
502 | | | 481 | |
503 | | | 482 | |
504 | | | 483 | |
505 | | | | |
506 | | | | |
507 | | | | |
508 | | | | |
509 | | | | |
510 | | | 468 | |
511 | | | 484 | |
512 | | | 485 | |
513 | | | 486 | |
Precondition Violations (3)
Row |
Violation |
1 | Unmatched statement state=SEXP; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched break states; |
3 | Clone fragment #1 returns variables i, ival, offset, chars, lastValidOffset , while Clone fragment #2 returns variables i, ival, offset, chars, lastValidOffset |