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
}
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;
}
}
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: 22
|
|
Number of AST nodes: 20
|
|
1 | if (i < buflen) {↵ | | 1 | for ( ; 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↵ | | |
|
6 | case '1': case '2': case '3': case '4':↵ | | 4 | case '1': case '2': case '3': case '4':↵
|
7 | case '5': case '6': case '7': case '8': case '9':↵ | | 5 | case '5': case '6': case '7': case '8': case '9':↵
|
8 | chars[offset++] = (char)ival;↵ | | 6 | chars[offset++] = (char)ival;↵
|
9 | lastValidOffset = offset;↵ | | 7 | lastValidOffset = offset;↵
|
10 | break; // switch↵ | | 8 | break;↵
|
11 | case '.':↵ | | 9 | case '_':↵
|
12 | state = SDECDIGIT;↵ | | 10 | ↵
|
13 | break states;↵ | | 11 | break;↵
|
14 | default:↵ | | 12 | default:↵
|
15 | state = SCOMPLETE;↵ | | 13 | state = SCOMPLETE;↵
|
16 | break states;↵ | | 14 | break states;↵
|
17 | } // switch↵ | | 15 | }↵
|
18 | } | | 16 | }
|
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 | 178 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 19 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 16.0 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
466 | switch (ival = bytes[i++]) | | 579 | switch (ival = bytes[i++]) |
467 | | | 589 | |
468 | | | 592 | |
469 | | | 581 | |
470 | | | 582 | |
471 | | | 583 | |
472 | | | 584 | |
473 | | | 585 | |
474 | | | 586 | |
475 | | | 587 | |
476 | | | 588 | |
477 | | | 593 | |
478 | chars[offset++] = (char)ival; | | 590 | chars[offset++] = (char)ival; |
479 | lastValidOffset = offset; | | 591 | lastValidOffset = offset; |
480 | | | 594 | |
481 | | | 580 | |
482 | | | 596 | |
483 | | | 597 | |
484 | | | 595 | |
485 | | | | |
486 | | | | |
Precondition Violations (2)
Row |
Violation |
1 | Unmatched break states; |
2 | Clone fragment #1 returns variables i, ival, offset, chars, lastValidOffset , while Clone fragment #2 returns variables i, ival, offset, chars, lastValidOffset |