final int lim = RubyNumeric.num2int(arg1); if (lim <= 0) { return splitCommon(arg0, false, lim, 1, context); } else { if (lim == 1) return value.realSize == 0 ? context.getRuntime().newArray() : context.getRuntime().newArray(this); return splitCommon(arg0, true, lim, 1, context); }
final int lim = RubyNumeric.num2int(arg1); if (lim <= 0) { return splitCommon19(arg0, false, lim, 1, context); } else { if (lim == 1) return value.realSize == 0 ? context.getRuntime().newArray() : context.getRuntime().newArray(this); return splitCommon19(arg0, true, lim, 1, context); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyString.java File path: /jruby-1.4.0/src/org/jruby/RubyString.java
Method name: RubyArray split(ThreadContext, IRubyObject, IRubyObject) Method name: RubyArray split19(ThreadContext, IRubyObject, IRubyObject)
Number of AST nodes: 6 Number of AST nodes: 6
1
final int lim = RubyNumeric.num2int(arg1);
1
final int lim = RubyNumeric.num2int(arg1);
2
        if (lim <= 0) {
2
        if (lim <= 0) {
3
            return splitCommon(arg0, false, lim, 1, context);
3
            return splitCommon19(arg0, false, lim, 1, context);
4
        } else {
4
        } else {
5
            if (lim == 1) return value.realSize == 0 ? context.getRuntime().newArray() : context.getRuntime().newArray(this);
5
            if (lim == 1) return value.realSize == 0 ? context.getRuntime().newArray() : context.getRuntime().newArray(this);
6
            return splitCommon(arg0, true, lim, 1, context);
6
            return splitCommon19(arg0, true, lim, 1, context);
7
        }
7
        }
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.3
Clones locationClones are declared in the same class
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    final int lim = RubyNumeric.num2int(arg1);
    1
    final int lim = RubyNumeric.num2int(arg1);
    2
    if (lim <= 0)
    2
    if (lim <= 0)
    3
    return splitCommon(arg0, false, lim, 1, context);
    3
    return splitCommon(arg0, false, lim, 1, context);
    3
    return splitCommon19(arg0, false, lim, 1, context);
    Differences
    Expression1Expression2Difference
    splitCommonsplitCommon19METHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression splitCommon(arg0,false,lim,1,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method splitCommon
    Expression splitCommon19(arg0,false,lim,1,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method splitCommon19
    3
    return splitCommon19(arg0, false, lim, 1, context);
    else
    else
    4
    if (lim == 1)
    4
    if (lim == 1)
    5
    return value.realSize == 0 ? context.getRuntime().newArray() : context.getRuntime().newArray(this);
    5
    return value.realSize == 0 ? context.getRuntime().newArray() : context.getRuntime().newArray(this);
    6
    return splitCommon(arg0, true, lim, 1, context);
    6
    return splitCommon(arg0, true, lim, 1, context);
    6
    return splitCommon19(arg0, true, lim, 1, context);
    Differences
    Expression1Expression2Difference
    splitCommonsplitCommon19METHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression splitCommon(arg0,true,lim,1,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method splitCommon
    Expression splitCommon19(arg0,true,lim,1,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method splitCommon19
    6
    return splitCommon19(arg0, true, lim, 1, context);
    Precondition Violations (4)
    Row Violation
    1Expression splitCommon(arg0,false,lim,1,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression splitCommon19(arg0,false,lim,1,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression splitCommon(arg0,true,lim,1,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression splitCommon19(arg0,true,lim,1,context) cannot be parameterized, because it has dependencies to/from statements that will be extracted