short[] array = new short[ary.size()];
for (int i = 0; i < array.length; ++i) {
array[i] = Util.int16Value(ary.entry(i));
}
io.put(offset, array, 0, array.length);
short[] array = new short[ary.size()];
for (int i = 0; i < array.length; ++i) {
array[i] = (short) Util.uint16Value(ary.entry(i));
}
io.put(offset, array, 0, array.length);
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: void putArrayOfSigned16(Ruby, MemoryIO, long, RubyArray)
|
|
Method name: void putArrayOfUnsigned16(Ruby, MemoryIO, long, RubyArray)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | short[] array = new short[ary.size()];↵ | | 1 | short[] array = new short[ary.size()];↵
|
2 | for (int i = 0; i < array.length; ++i) {↵ | | 2 | for (int i = 0; i < array.length; ++i) {↵
|
3 | array[i] = Util.int16Value(ary.entry(i));↵ | | 3 | array[i] = (short) Util.uint16Value(ary.entry(i));↵
|
4 | }↵ | | 4 | }↵
|
|
5 | io.put(offset, array, 0, array.length); | | 5 | io.put(offset, array, 0, array.length);
|
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 | 8 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 4 |
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.2 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | short[] array = new short[ary.size()]; | | 1 | short[] array = new short[ary.size()]; |
2 | for (int i = 0; i < array.length; ++i) | | 2 | for (int i = 0; i < array.length; ++i) |
3 | array[i] = Util.int16Value(ary.entry(i)); | | 3 | array[i] = (short)Util.uint16Value(ary.entry(i)); |
4 | io.put(offset, array, 0, array.length); | | 4 | io.put(offset, array, 0, array.length); |
Precondition Violations (2)
Row |
Violation |
1 | Expression Util.int16Value(ary.entry(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression (short)Util.uint16Value(ary.entry(i)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |