byte[] array = new byte[ary.size()]; for (int i = 0; i < array.length; ++i) { array[i] = (byte) Util.uint8Value(ary.entry(i)); } io.put(offset, array, 0, array.length);
double[] array = new double[ary.size()]; for (int i = 0; i < array.length; ++i) { array[i] = Util.doubleValue(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 putArrayOfUnsigned8(Ruby, MemoryIO, long, RubyArray) Method name: void putArrayOfFloat64(Ruby, MemoryIO, long, RubyArray)
Number of AST nodes: 4 Number of AST nodes: 4
1
byte[] array = new byte[ary.size()];
1
double[] array = new double[ary.size()];
2
        for (int i = 0; i < array.length; ++i) {
2
        for (int i = 0; i < array.length; ++i) {
3
            array[i] = (byte) Util.uint8Value(ary.entry(i));
3
            array[i] = Util.doubleValue(ary.entry(i));
4
        }
4
        }
5
        io.put(offset, array, 0, array.length);
5
        io.put(offset, array, 0, array.length);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are declared in the same class
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                      
    1
    double[] array = new double[ary.size()];
    1
    byte[] array = new byte[ary.size()];
                                                                              
    2
    for (int i = 0; i < array.length; ++i)
    2
    for (int i = 0; i < array.length; ++i)
    2
    for (int i = 0; i < array.length; ++i)
    Differences
    Expression1Expression2Difference
    byte[]double[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type byte[] of variable array does not match with type double[] of variable array
    • Make classes byte[] and double[] extend a common superclass
    2
    for (int i = 0; i < array.length; ++i)
                                                                                          
    3
    array[i] = Util.doubleValue(ary.entry(i));
    Preondition Violations
    Unmatched statement array[i]=Util.doubleValue(ary.entry(i)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    array[i] = Util.doubleValue(ary.entry(i));
    3
    array[i] = (byte)Util.uint8Value(ary.entry(i));
    3
    array[i] = (byte)Util.uint8Value(ary.entry(i));
    Preondition Violations
    Unmatched statement array[i]=(byte)Util.uint8Value(ary.entry(i)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                    
    4
    io.put(offset, array, 0, array.length);
    4
    io.put(offset, array, 0, array.length);
    4
    io.put(offset, array, 0, array.length);
    Differences
    Expression1Expression2Difference
    byte[]double[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type byte[] of variable array does not match with type double[] of variable array
    • Make classes byte[] and double[] extend a common superclass
    4
    io.put(offset, array, 0, array.length);
    Precondition Violations (4)
    Row Violation
    1Type byte[] of variable array does not match with type double[] of variable array
    2Unmatched statement array[i]=Util.doubleValue(ary.entry(i)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement array[i]=(byte)Util.uint8Value(ary.entry(i)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type byte[] of variable array does not match with type double[] of variable array