if ( 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
default:
state = SCOMPLETE;
break states;
} // switch
}
switch(ival = bytes[i++]) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
expSpec = (int)ival-(int)'0';
break; //switch
default:
state = SERR_NOT_STRICT;
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: 18
|
|
Number of AST nodes: 16
|
|
1 | if ( i < buflen) {↵ | | |
|
2 | switch(ival = bytes[i++]) {↵ | | 1 | switch(ival = bytes[i++]) {↵
|
3 | case '0': case '1': case '2': case '3': case '4':↵ | | 2 | case '0': case '1': case '2': case '3': case '4':↵
|
4 | case '5': case '6': case '7': case '8': case '9':↵ | | 3 | case '5': case '6': case '7': case '8': case '9':↵
|
5 | chars[offset++] = (char)ival;↵ | | 4 | ↵
|
6 | lastValidOffset = offset;↵ | | 5 | expSpec = (int)ival-(int)'0';↵
|
7 | break; // switch↵ | | 6 | break; //switch↵
|
8 | default:↵ | | 7 | default:↵
|
9 | state = SCOMPLETE;↵ | | 8 | state = SERR_NOT_STRICT;↵
|
10 | break states;↵ | | 9 | break states;↵
|
11 | } // switch↵ | | 10 | }
|
12 | } | | | |
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.7 |
Clones location | Clones are in the same method |
Number of node comparisons | 135 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 16 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 12.6 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
521 | switch (ival = bytes[i++]) | | 407 | switch (ival = bytes[i++]) |
522 | | | 408 | |
523 | | | 409 | |
524 | | | 410 | |
525 | | | 411 | |
526 | | | 412 | |
527 | | | 413 | |
528 | | | 414 | |
529 | | | 415 | |
530 | | | 416 | |
531 | | | 417 | |
532 | chars[offset++] = (char)ival; | | | |
533 | lastValidOffset = offset; | | 418 | expSpec = (int)ival - (int)'0'; |
534 | | | 419 | |
535 | | | 420 | |
536 | | | 421 | |
537 | | | 422 | |
Precondition Violations (3)
Row |
Violation |
1 | Unmatched statement chars[offset++]=(char)ival; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Expression (int)ival - (int)'0' cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Clone fragment #1 returns variables i, ival, lastValidOffset , while Clone fragment #2 returns variables i, expSpec |