if (next == '!' || next == '_') {
int index = NATIVE_CODES.indexOf(type);
if (index == -1) {
throw runtime.newArgumentError("'" + next +
"' allowed only after types " + NATIVE_CODES);
}
type = MAPPED_CODES.charAt(index);
next = safeGet(format);
}
if (next == '_' || next == '!') {
int index = NATIVE_CODES.indexOf(type);
if (index == -1) {
throw runtime.newArgumentError("'" + next +
"' allowed only after types " + NATIVE_CODES);
}
type = MAPPED_CODES.charAt(index);
next = safeGet(format);
}
Clone fragments detected by clone detection tool
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: RubyArray unpack(Ruby, ByteList, ByteList)
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | if (next == '!' || next == '_') {↵ | | 1 | if (next == '_' || next == '!') {↵
|
2 | int index = NATIVE_CODES.indexOf(type);↵ | | 2 | int index = NATIVE_CODES.indexOf(type);↵
|
3 | if (index == -1) {↵ | | 3 | if (index == -1) {↵
|
4 | throw runtime.newArgumentError("'" + next +↵ | | 4 | throw runtime.newArgumentError("'" + next +↵
|
5 | "' allowed only after types " + NATIVE_CODES);↵ | | 5 | "' allowed only after types " + NATIVE_CODES);↵
|
6 | }↵ | | 6 | }↵
|
7 | type = MAPPED_CODES.charAt(index);↵ | | 7 | type = MAPPED_CODES.charAt(index);↵
|
| | | 8 | ↵
|
8 | next = safeGet(format);↵ | | 9 | next = safeGet(format);↵
|
9 | } | | 10 | }
|
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.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 24 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 6 |
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.3 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
23 | if (next == '!' || next == '_') | | 9 | if (next == '_' || next == '!') |
24 | int index = NATIVE_CODES.indexOf(type); | | 10 | int index = NATIVE_CODES.indexOf(type); |
25 | | | 11 | |
26 | throw runtime.newArgumentError("'" + next + "' allowed only after types " + NATIVE_CODES); | | 12 | throw runtime.newArgumentError("'" + next + "' allowed only after types " + NATIVE_CODES); |
27 | type = MAPPED_CODES.charAt(index); | | 13 | type = MAPPED_CODES.charAt(index); |
28 | | | 14 | |
Precondition Violations (1)
Row |
Violation |
1 | Clone fragment #1 returns variables next, type , while Clone fragment #2 returns variables next, type |