while (s < end) {
c = codePoint(runtime, enc, bytes, s, end);
if (enc.isUpper(c)) {
enc.codeToMbc(toLower(enc, c), bytes, s);
modify = true;
}
s += codeLength(runtime, enc, c);
}
c = codePoint(runtime, enc, bytes, s, end);
if (enc.isLower(c)) {
enc.codeToMbc(toUpper(enc, c), bytes, s);
modify = true;
}
s += codeLength(runtime, enc, c);
Clone fragments detected by clone detection tool
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 capitalize_bang19(ThreadContext)
|
|
Method name: IRubyObject multiByteUpcase(Ruby, Encoding, byte[], int, int)
|
Number of AST nodes: 6
|
|
Number of AST nodes: 5
|
|
1 | while (s < end) {↵ | | |
|
2 | c = codePoint(runtime, enc, bytes, s, end);↵ | | 1 | c = codePoint(runtime, enc, bytes, s, end);↵
|
3 | if (enc.isUpper(c)) {↵ | | 2 | if (enc.isLower(c)) {↵
|
4 | enc.codeToMbc(toLower(enc, c), bytes, s);↵ | | 3 | enc.codeToMbc(toUpper(enc, c), bytes, s);↵
|
5 | modify = true;↵ | | 4 | modify = true;↵
|
6 | }↵ | | 5 | ↵
|
| | | 6 | }↵
|
7 | s += codeLength(runtime, enc, c);↵ | | 7 | s += codeLength(runtime, enc, c);
|
8 | } | | | |
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.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 14 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 5 |
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) | 2.6 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
17 | c = codePoint(runtime, enc, bytes, s, end); | | 9 | c = codePoint(runtime, enc, bytes, s, end); |
18 | if (enc.isUpper(c)) | | 10 | if (enc.isLower(c)) |
19 | enc.codeToMbc(toLower(enc, c), bytes, s); | | 11 | enc.codeToMbc(toUpper(enc, c), bytes, s); |
20 | | | 12 | |
21 | s += codeLength(runtime, enc, c); | | 13 | s += codeLength(runtime, enc, c); |
Precondition Violations (5)
Row |
Violation |
1 | Expression enc.isUpper(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression enc.isLower(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression toLower(enc,c) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression toUpper(enc,c) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Clone fragment #1 returns variables s, modify , while Clone fragment #2 returns variables s, modify |