int[] array = new int[count];
io.get(offset, array, 0, array.length);
RubyArray arr = RubyArray.newArray(runtime, array.length);
for (int i = 0; i < array.length; ++i) {
arr.add(Util.newSigned32(runtime, array[i]));
}
return arr;
int[] array = new int[count];
io.get(offset, array, 0, array.length);
RubyArray arr = RubyArray.newArray(runtime, array.length);
for (int i = 0; i < array.length; ++i) {
arr.add(Util.newUnsigned32(runtime, array[i]));
}
return arr;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/ext/ffi/MemoryUtil.java
|
|
File path: /jruby-1.4.0/src/org/jruby/ext/ffi/MemoryUtil.java
|
Method name: IRubyObject getArrayOfSigned32(Ruby, MemoryIO, long, int)
|
|
Method name: IRubyObject getArrayOfUnsigned32(Ruby, MemoryIO, long, int)
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | int[] array = new int[count];↵ | | 1 | int[] array = new int[count];↵
|
2 | io.get(offset, array, 0, array.length);↵ | | 2 | io.get(offset, array, 0, array.length);↵
|
|
3 | RubyArray arr = RubyArray.newArray(runtime, array.length);↵ | | 3 | RubyArray arr = RubyArray.newArray(runtime, array.length);↵
|
4 | for (int i = 0; i < array.length; ++i) {↵ | | 4 | for (int i = 0; i < array.length; ++i) {↵
|
5 | arr.add(Util.newSigned32(runtime, array[i]));↵ | | 5 | arr.add(Util.newUnsigned32(runtime, array[i]));↵
|
6 | }↵ | | 6 | }↵
|
|
7 | return arr; | | 7 | return arr;
|
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 | 20 |
-
{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) | 1.7 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | int[] array = new int[count]; | | 1 | int[] array = new int[count]; |
2 | io.get(offset, array, 0, array.length); | | 2 | io.get(offset, array, 0, array.length); |
3 | RubyArray arr = RubyArray.newArray(runtime, array.length); | | 3 | RubyArray arr = RubyArray.newArray(runtime, array.length); |
4 | for (int i = 0; i < array.length; ++i) | | 4 | for (int i = 0; i < array.length; ++i) |
5 | arr.add(Util.newSigned32(runtime, array[i])); | | 5 | arr.add(Util.newUnsigned32(runtime, array[i])); |
6 | return arr; | | 6 | return arr; |
Precondition Violations (2)
Row |
Violation |
1 | Expression Util.newSigned32(runtime,array[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression Util.newUnsigned32(runtime,array[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted |