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 'e':
case 'E':
state = SEXP;
break states;
case '_':
break; // switch
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: 24
|
|
Number of AST nodes: 20
|
|
1 | for ( ; i < buflen ; ) {↵ | | 1 | for ( ; i < buflen; ) {↵
|
2 | switch(ival = bytes[i++]) {↵ | | 2 | switch(ival = bytes[i++]) {↵
|
3 | case '0': case '1': case '2': case '3': case '4':↵ | | 3 | case '0': case '1': case '2': case '3': case '4':↵
|
4 | case '5': case '6': case '7': case '8': case '9':↵ | | 4 | case '5': case '6': case '7': case '8': case '9':↵
|
5 | chars[offset++] = (char)ival;↵ | | 5 | chars[offset++] = (char)ival;↵
|
6 | lastValidOffset = offset;↵ | | 6 | lastValidOffset = offset;↵
|
7 | break; // switch↵ | | 7 | break;↵
|
8 | case 'e':↵ | | |
|
9 | case 'E':↵ | | |
|
10 | state = SEXP;↵ | | |
|
11 | break states;↵ | | |
|
12 | case '_':↵ | | 8 | case '_':↵
|
13 | break; // switch↵ | | 9 | break;↵
|
14 | default:↵ | | 10 | default:↵
|
15 | state = SCOMPLETE;↵ | | 11 | state = SCOMPLETE;↵
|
16 | break states;↵ | | 12 | break states;↵
|
17 | } // switch↵ | | 13 | }↵
|
18 | } | | 14 | }
|
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.8 |
Clones location | Clones are in the same method |
Number of node comparisons | 193 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 20 |
Number of unmapped statements in the first code fragment | 4 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 16.5 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
538 | for (; i < buflen; ) | | 578 | for (; i < buflen; ) |
539 | switch (ival = bytes[i++]) | | 579 | switch (ival = bytes[i++]) |
540 | | | 580 | |
541 | | | 581 | |
542 | | | 582 | |
543 | | | 583 | |
544 | | | 584 | |
545 | | | 585 | |
546 | | | 586 | |
547 | | | 587 | |
548 | | | 588 | |
549 | | | 589 | |
550 | chars[offset++] = (char)ival; | | 590 | chars[offset++] = (char)ival; |
551 | lastValidOffset = offset; | | 591 | lastValidOffset = offset; |
552 | | | 592 | |
553 | | | 593 | |
554 | | | | |
555 | | | 596 | |
556 | | | 597 | |
557 | | | | |
558 | | | 594 | |
559 | | | 595 | |
560 | | | | |
561 | | | | |
Precondition Violations (3)
Row |
Violation |
1 | Unmatched statement state=SCOMPLETE; 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 |