while (p < end) {
int cl = StringSupport.length(enc, bytes, p, end);
if (cl > 1 || (bytes[p] & 0x80) != 0) {
single = false;
op -= cl;
System.arraycopy(bytes, p, obytes, op, cl);
p += cl;
} else {
obytes[--op] = bytes[p++];
}
}
while (p < end) {
int cl = StringSupport.length(enc, bytes, p, end);
if (cl > 1 || (bytes[p] & 0x80) != 0) {
single = false;
op -= cl;
System.arraycopy(bytes, p, obytes, op, cl);
p += cl;
} else {
obytes[--op] = bytes[p++];
}
}
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: RubyString reverse_bang19(ThreadContext)
|
|
Method name: IRubyObject reverse19(ThreadContext)
|
Number of AST nodes: 8
|
|
Number of AST nodes: 8
|
|
1 | while (p < end) {↵ | | 1 | while (p < end) {↵
|
2 | int cl = StringSupport.length(enc, bytes, p, end);↵ | | 2 | int cl = StringSupport.length(enc, bytes, p, end);↵
|
3 | if (cl > 1 || (bytes[p] & 0x80) != 0) {↵ | | 3 | if (cl > 1 || (bytes[p] & 0x80) != 0) {↵
|
4 | single = false;↵ | | 4 | single = false;↵
|
5 | op -= cl;↵ | | 5 | op -= cl;↵
|
6 | System.arraycopy(bytes, p, obytes, op, cl);↵ | | 6 | System.arraycopy(bytes, p, obytes, op, cl);↵
|
7 | p += cl;↵ | | 7 | p += cl;↵
|
8 | } else {↵ | | 8 | } else {↵
|
9 | obytes[--op] = bytes[p++];↵ | | 9 | obytes[--op] = bytes[p++];↵
|
10 | }↵ | | 10 | ↵
|
11 | ↵ | | 11 | }↵
|
12 | } | | 12 | }
|
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) | 1.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 44 |
-
{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.5 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
16 | while (p < end) | | 16 | while (p < end) |
17 | int cl = StringSupport.length(enc, bytes, p, end); | | 17 | int cl = StringSupport.length(enc, bytes, p, end); |
18 | if (cl > 1 || (bytes[p] & 0x80) != 0) | | 18 | if (cl > 1 || (bytes[p] & 0x80) != 0) |
19 | | | 19 | |
20 | | | 20 | |
21 | System.arraycopy(bytes, p, obytes, op, cl); | | 21 | System.arraycopy(bytes, p, obytes, op, cl); |
22 | | | 22 | |
| | | | |
23 | obytes[--op] = bytes[p++]; | | 23 | obytes[--op] = bytes[p++]; |
Precondition Violations (1)
Row |
Violation |
1 | Clone fragment #1 returns variables obytes, single , while Clone fragment #2 returns variables obytes, single |