File path: /jruby-1.4.0/src/org/jruby/RubyString.java | File path: /jruby-1.4.0/src/org/jruby/RubyString.java | |||
Method name: NeighborChar predChar(Encoding, byte[], int, int)
|
Method name: NeighborChar succChar(Encoding, byte[], int, int)
|
|||
Number of AST nodes: 20 | Number of AST nodes: 20 | |||
1 | while (true) {↵ | 1 | while (true) {↵ | |
2 | int i = len - 1;↵ | 2 | int i = len - 1;↵ | |
3 | for (; i >= 0 && bytes[p + i] == 0; i--) bytes[p + i] = (byte)0xff;↵ | 3 | for (; i >= 0 && bytes[p + i] == (byte)0xff; i--) bytes[p + i] = 0;↵ | |
4 | if (i < 0) return NeighborChar.WRAPPED;↵ | 4 | if (i < 0) return NeighborChar.WRAPPED;↵ | |
5 | bytes[p + i] = (byte)((bytes[p + i] & 0xff) - 1);↵ | 5 | bytes[p + i] = (byte)((bytes[p + i] & 0xff) + 1);↵ | |
6 | int cl = StringSupport.preciseLength(enc, bytes, p, p + len);↵ | 6 | int cl = StringSupport.preciseLength(enc, bytes, p, p + len);↵ | |
7 | if (cl > 0) {↵ | 7 | if (cl > 0) {↵ | |
8 | if (cl == len) {↵ | 8 | if (cl == len) {↵ | |
9 | return NeighborChar.FOUND;↵ | 9 | return NeighborChar.FOUND;↵ | |
10 | } else {↵ | 10 | } else {↵ | |
11 | for (int j = p + cl; j < p + len - cl; j++) bytes[j] = 0;↵ | 11 | for (int j = p + cl; j < p + len - cl; j++) bytes[j] = (byte)0xff;↵ | |
12 | }↵ | 12 | }↵ | |
13 | }↵ | 13 | }↵ | |
14 | if (cl == -1 && i < len - 1) {↵ | 14 | if (cl == -1 && i < len - 1) {↵ | |
15 | int len2 = len - 1;↵ | 15 | int len2 = len - 1;↵ | |
16 | for (; len2 > 0; len2--) {↵ | 16 | for (; len2 > 0; len2--) {↵ | |
17 | if (StringSupport.preciseLength(enc, bytes, p, p + len2) != -1) break;↵ | 17 | if (StringSupport.preciseLength(enc, bytes, p, p + len2) != -1) break;↵ | |
18 | }↵ | 18 | }↵ | |
19 | for (int j = p + len2 + 1; j < p + len - (len2 + 1); j++) bytes[j] = 0;↵ | 19 | for (int j = p + len2 + 1; j < p + len - (len2 + 1); j++) bytes[j] = (byte)0xff;↵ | |
20 | }↵ | 20 | }↵ | |
21 | } | 21 |
| |
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) | 9.7 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 66 |
Number of mapped statements | 15 |
Number of unmapped statements in the first code fragment | 5 |
Number of unmapped statements in the second code fragment | 5 |
Time elapsed for statement mapping (ms) | 11.9 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||
---|---|---|---|---|---|---|---|
1 | while (true) | 1 | while (true) | ||||
2 | int i = len - 1; | 2 | int i = len - 1; | ||||
|
| 3 | for (; i >= 0 && bytes[p + i] == (byte)0xff; i--) | ||||
|
| 4 | bytes[p + i] = 0; | ||||
3 | for (; i >= 0 && bytes[p + i] == 0; i--) |
| | ||||
4 | bytes[p + i] = (byte)0xff; |
| | ||||
5 | if (i < 0) | 5 | if (i < 0) | ||||
6 | return NeighborChar.WRAPPED; | 6 | return NeighborChar.WRAPPED; | ||||
|
| 7 | bytes[p + i] = (byte)((bytes[p + i] & 0xff) + 1); | ||||
7 | bytes[p + i] = (byte)((bytes[p + i] & 0xff) - 1); |
| | ||||
8 | int cl = StringSupport.preciseLength(enc, bytes, p, p + len); | 8 | int cl = StringSupport.preciseLength(enc, bytes, p, p + len); | ||||
9 | if (cl > 0) | 9 | if (cl > 0) | ||||
10 | if (cl == len) | 10 | if (cl == len) | ||||
11 | return NeighborChar.FOUND; | 11 | return NeighborChar.FOUND; | ||||
else | else | ||||||
12 | for (int j = p + cl; j < p + len - cl; j++) | 12 | for (int j = p + cl; j < p + len - cl; j++) | ||||
|
| 13 | bytes[j] = (byte)0xff; | ||||
13 | bytes[j] = 0; |
| | ||||
14 | if (cl == -1 && i < len - 1) | 14 | if (cl == -1 && i < len - 1) | ||||
15 | int len2 = len - 1; | 15 | int len2 = len - 1; | ||||
16 | for (; len2 > 0; len2--) | 16 | for (; len2 > 0; len2--) | ||||
17 | if (StringSupport.preciseLength(enc, bytes, p, p + len2) != -1) | 17 | if (StringSupport.preciseLength(enc, bytes, p, p + len2) != -1) | ||||
18 | break; | 18 | break; | ||||
19 | for (int j = p + len2 + 1; j < p + len - (len2 + 1); j++) | 19 | for (int j = p + len2 + 1; j < p + len - (len2 + 1); j++) | ||||
|
| 20 | bytes[j] = (byte)0xff; | ||||
20 | bytes[j] = 0; |
| |
Row | Violation |
---|---|
1 | Unmatched statement for(i >= 0 && bytes[p + i] == (byte)0xff; i--) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement bytes[p + i]=0; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement for(i >= 0 && bytes[p + i] == 0; i--) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement bytes[p + i]=(byte)0xff; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement bytes[p + i]=(byte)((bytes[p + i] & 0xff) + 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched statement bytes[p + i]=(byte)((bytes[p + i] & 0xff) - 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
7 | Unmatched statement bytes[j]=(byte)0xff; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
8 | Unmatched statement bytes[j]=0; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
9 | Unmatched statement bytes[j]=(byte)0xff; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
10 | Unmatched statement bytes[j]=0; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
11 | Clone fragment #1 returns variables i, j, j , while Clone fragment #2 returns variables i, j, j |