boolean modify = false;
while (s < end) {
int c = bytes[s] & 0xff;
if (ASCII.isUpper(c)) {
bytes[s] = AsciiTables.ToLowerCaseTable[c];
modify = true;
}
s++;
}
return modify ? this : runtime.getNil();
boolean modify = false;
while (s < end) {
int c = bytes[s] & 0xff;
if (ASCII.isLower(c)) {
bytes[s] = AsciiTables.ToUpperCaseTable[c];
modify = true;
}
s++;
}
return modify ? this : runtime.getNil();
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 singleByteDowncase(Ruby, byte[], int, int)
|
|
Method name: IRubyObject singleByteUpcase(Ruby, byte[], int, int)
|
Number of AST nodes: 8
|
|
Number of AST nodes: 8
|
|
1 | boolean modify = false;↵ | | 1 | boolean modify = false;↵
|
2 | while (s < end) {↵ | | 2 | while (s < end) {↵
|
3 | int c = bytes[s] & 0xff;↵ | | 3 | int c = bytes[s] & 0xff;↵
|
4 | if (ASCII.isUpper(c)) {↵ | | 4 | if (ASCII.isLower(c)) {↵
|
5 | bytes[s] = AsciiTables.ToLowerCaseTable[c];↵ | | 5 | bytes[s] = AsciiTables.ToUpperCaseTable[c];↵
|
6 | modify = true;↵ | | 6 | modify = true;↵
|
7 | }↵ | | 7 | }↵
|
8 | s++;↵ | | 8 | s++;↵
|
9 | }↵ | | 9 | }↵
|
10 | return modify ? this : runtime.getNil(); | | 10 | return modify ? this : runtime.getNil();
|
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 22 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 8 |
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) | 3.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | boolean modify = false; | | 1 | boolean modify = false; |
2 | while (s < end) | | 2 | while (s < end) |
3 | | | 3 | |
4 | | | 4 | |
5 | bytes[s] = AsciiTables.ToLowerCaseTable[c]; | | 5 | bytes[s] = AsciiTables.ToUpperCaseTable[c]; |
6 | | | 6 | |
7 | | | 7 | |
8 | return modify ? this : runtime.getNil(); | | 8 | return modify ? this : runtime.getNil(); |
Precondition Violations (2)
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 |