for (int i = 0; i < len; i++) { RubyArray tmp = new RubyArray(runtime, args.length + 1); tmp.append(elt(i)); for (int j = 0; j < args.length; j++) { tmp.append(((RubyArray) args[j]).elt(i)); } result.append(tmp); }
for (int i = 0; i < realLength; i++) { RubyArray tmp = new RubyArray(runtime, args.length + 1); tmp.append(elt(i)); for (int j = 0; j < args.length; j++) { tmp.append(((RubyArray) args[j]).elt(i)); } block.yield(context, tmp); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyArray.java File path: /jruby-1.4.0/src/org/jruby/RubyArray.java
Method name: IRubyObject zip(ThreadContext, IRubyObject[], Block) Method name: IRubyObject zip(ThreadContext, IRubyObject[], Block)
Number of AST nodes: 6 Number of AST nodes: 6
1
for (int i = 0; i < len; i++) {
1
for (int i = 0; i < realLength; i++) {
2
            RubyArray tmp = new RubyArray(runtime, args.length + 1);
2
                RubyArray tmp = new RubyArray(runtime, args.length + 1);
3
            tmp.append(elt(i));
3
                tmp.append(elt(i));
4
            for (int j = 0; j < args.length; j++) {
4
                for (int j = 0; j < args.length; j++) {
5
                tmp.append(((RubyArray) args[j]).elt(i));
5
                    tmp.append(((RubyArray) args[j]).elt(i));
6
            }
6
                }
7
            result.append(tmp);
7
                block.yield(context, tmp);
8
        }
8
            }
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.5
Clones locationClones are in the same method
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)3.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    14
    for (int i = 0; i < len; i++)
    14
    for (int i = 0; i < len; i++)
    5
    for (int i = 0; i < realLength; i++)
    Differences
    Expression1Expression2Difference
    lenrealLengthVARIABLE_NAME_MISMATCH
    5
    for (int i = 0; i < realLength; i++)
    15
    RubyArray tmp = new RubyArray(runtime, args.length + 1);
    6
    RubyArray tmp = new RubyArray(runtime, args.length + 1);
    16
    tmp.append(elt(i));
    7
    tmp.append(elt(i));
    17
    for (int j = 0; j < args.length; j++)
    8
    for (int j = 0; j < args.length; j++)
    18
    tmp.append(((RubyArray)args[j]).elt(i));
    9
    tmp.append(((RubyArray)args[j]).elt(i));
                                                              
    10
    block.yield(context, tmp);
    Preondition Violations
    Unmatched statement block.yield(context,tmp); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    block.yield(context, tmp);
    19
    result.append(tmp);
    19
    result.append(tmp);
    Preondition Violations
    Unmatched statement result.append(tmp); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                  
    Precondition Violations (2)
    Row Violation
    1Unmatched statement block.yield(context,tmp); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement result.append(tmp); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted