File path: /jruby-1.4.0/src/org/jruby/RubyString.java | File path: /jruby-1.4.0/src/org/jruby/RubyString.java | |||
Method name: IRubyObject multiByteDowncase(Ruby, Encoding, byte[], int, int)
|
Method name: IRubyObject multiByteUpcase(Ruby, Encoding, byte[], int, int)
|
|||
Number of AST nodes: 14 | Number of AST nodes: 14 | |||
1 | boolean modify = false;↵ | 1 | boolean modify = false;↵ | |
2 | int c;↵ | 2 | int c;↵ | |
3 | while (s < end) {↵ | 3 | while (s < end) {↵ | |
4 | if (enc.isAsciiCompatible() && Encoding.isAscii(c = bytes[s] & 0xff)) {↵ | 4 | if (enc.isAsciiCompatible() && Encoding.isAscii(c = bytes[s] & 0xff)) {↵ | |
5 | if (ASCII.isUpper(c)) {↵ | 5 | if (ASCII.isLower(c)) {↵ | |
6 | bytes[s] = AsciiTables.ToLowerCaseTable[c];↵ | 6 | bytes[s] = AsciiTables.ToUpperCaseTable[c];↵ | |
7 | modify = true;↵ | 7 | modify = true;↵ | |
8 | }↵ | 8 | }↵ | |
9 | s++;↵ | 9 | s++;↵ | |
10 | } else {↵ | 10 | } else {↵ | |
11 | c = codePoint(runtime, enc, bytes, s, end);↵ | 11 | c = codePoint(runtime, enc, bytes, s, end);↵ | |
12 | if (enc.isUpper(c)) {↵ | 12 | if (enc.isLower(c)) {↵ | |
13 | enc.codeToMbc(toLower(enc, c), bytes, s);↵ | 13 | enc.codeToMbc(toUpper(enc, c), bytes, s);↵ | |
14 | modify = true;↵ | 14 | modify = true;↵ | |
15 | }↵ | 15 | }↵ | |
16 | s += codeLength(runtime, enc, c);↵ | 16 | s += codeLength(runtime, enc, c);↵ | |
17 | }↵ | 17 | }↵ | |
18 | }↵ | 18 | }↵ | |
19 | return modify ? this : runtime.getNil(); | 19 |
| |
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) | 1.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 54 |
Number of mapped statements | 14 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 6.9 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | boolean modify = false; | 1 | boolean modify = false; | |||||||||||||
2 | int c; | 2 | int c; | |||||||||||||
3 | while (s < end) | 3 | while (s < end) | |||||||||||||
4 | if (enc.isAsciiCompatible() && Encoding.isAscii(c = bytes[s] & 0xff)) | 4 | if (enc.isAsciiCompatible() && Encoding.isAscii(c = bytes[s] & 0xff)) | |||||||||||||
5 | if (ASCII.isUpper(c)) |
| 5 | if (ASCII.isLower(c)) | ||||||||||||
6 | bytes[s] = AsciiTables.ToLowerCaseTable[c]; |
| 6 | bytes[s] = AsciiTables.ToUpperCaseTable[c]; | ||||||||||||
7 | modify = true; | 7 | modify = true; | |||||||||||||
8 | s++; | 8 | s++; | |||||||||||||
else | else | |||||||||||||||
9 | c = codePoint(runtime, enc, bytes, s, end); | 9 | c = codePoint(runtime, enc, bytes, s, end); | |||||||||||||
10 | if (enc.isUpper(c)) |
| 10 | if (enc.isLower(c)) | ||||||||||||
11 | enc.codeToMbc(toLower(enc, c), bytes, s); |
| 11 | enc.codeToMbc(toUpper(enc, c), bytes, s); | ||||||||||||
12 | modify = true; | 12 | modify = true; | |||||||||||||
13 | s += codeLength(runtime, enc, c); | 13 | s += codeLength(runtime, enc, c); | |||||||||||||
14 | return modify ? this : runtime.getNil(); | 14 | return modify ? this : runtime.getNil(); |
Row | Violation |
---|---|
1 | Expression ASCII.isUpper(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression ASCII.isLower(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression enc.isUpper(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression enc.isLower(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression toLower(enc,c) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression toUpper(enc,c) cannot be parameterized, because it has dependencies to/from statements that will be extracted |