File path: /jruby-1.4.0/src/org/jruby/util/Pack.java | File path: /jruby-1.4.0/src/org/jruby/util/Pack.java | |||
Method name: RubyString pack(Ruby, RubyArray, ByteList)
|
Method name: RubyString pack(Ruby, RubyArray, ByteList)
|
|||
Number of AST nodes: 19 | Number of AST nodes: 19 | |||
1 | int currentByte = 0;↵ | 1 | int currentByte = 0;↵ | |
2 | int padLength = 0;↵ | 2 | int padLength = 0;↵ | |
3 | if (occurrences > lCurElemString.length()) {↵ | 3 | if (occurrences > lCurElemString.length()) {↵ | |
4 | padLength = occurrences - lCurElemString.length() + 1;↵ | 4 | padLength = occurrences - lCurElemString.length() + 1;↵ | |
5 | occurrences = lCurElemString.length();↵ | 5 | occurrences = lCurElemString.length();↵ | |
6 | }↵ | 6 | }↵ | |
7 | for (int i = 0; i < occurrences;) {↵ | 7 | for (int i = 0; i < occurrences;) {↵ | |
8 | byte currentChar = (byte)lCurElemString.charAt(i++);↵ | 8 | byte currentChar = (byte)lCurElemString.charAt(i++);↵ | |
9 | if (Character.isJavaIdentifierStart(currentChar)) {↵ | 9 | if (Character.isJavaIdentifierStart(currentChar)) {↵ | |
10 | //this test may be too lax but it is the same as in MRI↵ | 10 | //this test may be too lax but it is the same as in MRI↵ | |
11 | currentByte |= ((currentChar & 15) + 9) & 15;↵ | 11 | currentByte |= (((currentChar & 15) + 9) & 15) << 4;↵ | |
12 | } else {↵ | 12 | } else {↵ | |
13 | currentByte |= currentChar & 15;↵ | 13 | currentByte |= (currentChar & 15) << 4;↵ | |
14 | }↵ | 14 | }↵ | |
15 | if ((i & 1) != 0) {↵ | 15 | if ((i & 1) != 0) {↵ | |
16 | currentByte <<= 4;↵ | 16 | currentByte >>= 4;↵ | |
17 | } else {↵ | 17 | } else {↵ | |
18 | result.append((byte) (currentByte & 0xff));↵ | 18 | result.append((byte) (currentByte & 0xff));↵ | |
19 | currentByte = 0;↵ | 19 | currentByte = 0;↵ | |
20 | }↵ | 20 | }↵ | |
21 | }↵ | 21 | }↵ | |
22 | if ((occurrences & 1) != 0) {↵ | 22 | if ((occurrences & 1) != 0) {↵ | |
23 | result.append((byte) (currentByte & 0xff));↵ | 23 | result.append((byte) (currentByte & 0xff));↵ | |
24 | if(padLength > 0) {↵ | 24 | if(padLength > 0) {↵ | |
25 | padLength--;↵ | 25 | padLength--;↵ | |
26 | }↵ | 26 | }↵ | |
27 | }↵ | 27 | }↵ | |
28 | result.length(result.length() + padLength / 2); | 28 |
| |
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) | 4.5 |
Clones location | Clones are in the same method |
Number of node comparisons | 83 |
Number of mapped statements | 16 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 16.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||
---|---|---|---|---|---|---|---|
143 | int currentByte = 0; | 122 | int currentByte = 0; | ||||
144 | int padLength = 0; | 123 | int padLength = 0; | ||||
145 | if (occurrences > lCurElemString.length()) | 124 | if (occurrences > lCurElemString.length()) | ||||
146 | padLength = occurrences - lCurElemString.length() + 1; | 125 | padLength = occurrences - lCurElemString.length() + 1; | ||||
147 | occurrences = lCurElemString.length(); | 126 | occurrences = lCurElemString.length(); | ||||
148 | for (int i = 0; i < occurrences; ) | 127 | for (int i = 0; i < occurrences; ) | ||||
149 | byte currentChar = (byte)lCurElemString.charAt(i++); | 128 | byte currentChar = (byte)lCurElemString.charAt(i++); | ||||
150 | if (Character.isJavaIdentifierStart(currentChar)) | 129 | if (Character.isJavaIdentifierStart(currentChar)) | ||||
|
| 130 | currentByte |= (((currentChar & 15) + 9) & 15) << 4; | ||||
151 | currentByte |= ((currentChar & 15) + 9) & 15; |
| | ||||
else | | ||||||
|
| 131 | currentByte |= (currentChar & 15) << 4; | ||||
152 | currentByte |= currentChar & 15; |
| | ||||
153 | if ((i & 1) != 0) | 132 | if ((i & 1) != 0) | ||||
| 133 | currentByte >>= 4; | |||||
154 | currentByte <<= 4; | | |||||
else | else | ||||||
155 | result.append((byte)(currentByte & 0xff)); | 134 | result.append((byte)(currentByte & 0xff)); | ||||
156 | currentByte = 0; | 135 | currentByte = 0; | ||||
157 | if ((occurrences & 1) != 0) | 136 | if ((occurrences & 1) != 0) | ||||
158 | result.append((byte)(currentByte & 0xff)); | 137 | result.append((byte)(currentByte & 0xff)); | ||||
159 | if (padLength > 0) | 138 | if (padLength > 0) | ||||
160 | padLength--; | 139 | padLength--; | ||||
161 | result.length(result.length() + padLength / 2); | 140 | result.length(result.length() + padLength / 2); |
Row | Violation |
---|---|
1 | Unmatched statement currentByte|=(((currentChar & 15) + 9) & 15) << 4; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement currentByte|=((currentChar & 15) + 9) & 15; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement currentByte|=(currentChar & 15) << 4; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement currentByte|=currentChar & 15; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Clone fragment #1 returns variables currentByte, currentChar , while Clone fragment #2 returns variables currentByte, currentChar |