long[] array = new long[ary.size()]; for (int i = 0; i < array.length; ++i) { array[i] = Util.uint64Value(ary.entry(i)); } io.put(offset, array, 0, array.length);
float[] array = new float[ary.size()]; for (int i = 0; i < array.length; ++i) { array[i] = Util.floatValue(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 putArrayOfUnsigned64(Ruby, MemoryIO, long, RubyArray) Method name: void putArrayOfFloat32(Ruby, MemoryIO, long, RubyArray)
Number of AST nodes: 4 Number of AST nodes: 4
1
long[] array = new long[ary.size()];
1
float[] array = new float[ary.size()];
2
        for (int i = 0; i < array.length; ++i) {
2
        for (int i = 0; i < array.length; ++i) {
3
            array[i] = Util.uint64Value(ary.entry(i));
3
            array[i] = Util.floatValue(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
    float[] array = new float[ary.size()];
    1
    long[] array = new long[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
    long[]float[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type long[] of variable array does not match with type float[] of variable array
    • Make classes long[] and float[] extend a common superclass
    2
    for (int i = 0; i < array.length; ++i)
                                                                                        
    3
    array[i] = Util.floatValue(ary.entry(i));
    Preondition Violations
    Unmatched statement array[i]=Util.floatValue(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.floatValue(ary.entry(i));
    3
    array[i] = Util.uint64Value(ary.entry(i));
    3
    array[i] = Util.uint64Value(ary.entry(i));
    Preondition Violations
    Unmatched statement array[i]=Util.uint64Value(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
    long[]float[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type long[] of variable array does not match with type float[] of variable array
    • Make classes long[] and float[] extend a common superclass
    4
    io.put(offset, array, 0, array.length);
    Precondition Violations (4)
    Row Violation
    1Type long[] of variable array does not match with type float[] of variable array
    2Unmatched statement array[i]=Util.floatValue(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]=Util.uint64Value(ary.entry(i)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type long[] of variable array does not match with type float[] of variable array