if (!sr.isNil()) { if (sr.callMethod(context, "include?", runtime.newString(new ByteList(new byte[]{'/'}))).isTrue()) { r = f_to_r(context, sr); } else if (f_gt_p(context, sr.callMethod(context, "count", runtime.newString(".eE")), RubyFixnum.zero(runtime)).isTrue()) { r = f_to_f(context, sr); } else { r = f_to_i(context, sr); } }
if (!si.isNil()) { if (si.callMethod(context, "include?", runtime.newString(new ByteList(new byte[]{'/'}))).isTrue()) { i = f_to_r(context, si); } else if (f_gt_p(context, si.callMethod(context, "count", runtime.newString(".eE")), RubyFixnum.zero(runtime)).isTrue()) { i = f_to_f(context, si); } else { i = f_to_i(context, si); } }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyComplex.java File path: /jruby-1.4.0/src/org/jruby/RubyComplex.java
Method name: RubyArray str_to_c_internal(ThreadContext, IRubyObject) Method name: RubyArray str_to_c_internal(ThreadContext, IRubyObject)
Number of AST nodes: 6 Number of AST nodes: 6
1
if (!sr.isNil()) {
1
if (!si.isNil()) {
2
            if (sr.callMethod(context, "include?", runtime.newString(new ByteList(new byte[]{'/'}))).isTrue()) {
2
            if (si.callMethod(context, "include?", runtime.newString(new ByteList(new byte[]{'/'}))).isTrue()) {
3
                r = f_to_r(context, sr);
3
                i = f_to_r(context, si);
4
            } else if (f_gt_p(context, sr.callMethod(context, "count", runtime.newString(".eE")), RubyFixnum.zero(runtime)).isTrue()) {
4
            } else if (f_gt_p(context, si.callMethod(context, "count", runtime.newString(".eE")), RubyFixnum.zero(runtime)).isTrue()) {
5
                r = f_to_f(context, sr); 
5
                i = f_to_f(context, si);
6
            } else {
6
            } else {
7
                r = f_to_i(context, sr);
7
                i = f_to_i(context, si);
8
            }
8
            }
9
        }
9
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)1.6
Clones locationClones are in the same method
Number of node comparisons21
  1. {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)12.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    44
    if (!sr.isNil())
    44
    if (!sr.isNil())
    50
    if (!si.isNil())
    Differences
    Expression1Expression2Difference
    srsiVARIABLE_NAME_MISMATCH
    50
    if (!si.isNil())
    45
    if (sr.callMethod(context, "include?", runtime.newString(new ByteList(new byte[] {'/'}))).isTrue())
    45
    if (sr.callMethod(context, "include?", runtime.newString(new ByteList(new byte[] {'/'}))).isTrue())
    51
    if (si.callMethod(context, "include?", runtime.newString(new ByteList(new byte[] {'/'}))).isTrue())
    Differences
    Expression1Expression2Difference
    srsiVARIABLE_NAME_MISMATCH
    51
    if (si.callMethod(context, "include?", runtime.newString(new ByteList(new byte[] {'/'}))).isTrue())
    46
    r = f_to_r(context, sr);
    46
    r = f_to_r(context, sr);
    52
    i = f_to_r(context, si);
    Differences
    Expression1Expression2Difference
    riVARIABLE_NAME_MISMATCH
    srsiVARIABLE_NAME_MISMATCH
    52
    i = f_to_r(context, si);
    47
    else if (f_gt_p(context, sr.callMethod(context, "count", runtime.newString(".eE")), RubyFixnum.zero(runtime)).isTrue())
    47
    else if (f_gt_p(context, sr.callMethod(context, "count", runtime.newString(".eE")), RubyFixnum.zero(runtime)).isTrue())
    53
    else if (f_gt_p(context, si.callMethod(context, "count", runtime.newString(".eE")), RubyFixnum.zero(runtime)).isTrue())
    Differences
    Expression1Expression2Difference
    srsiVARIABLE_NAME_MISMATCH
    53
    else if (f_gt_p(context, si.callMethod(context, "count", runtime.newString(".eE")), RubyFixnum.zero(runtime)).isTrue())
    48
    r = f_to_f(context, sr);
    48
    r = f_to_f(context, sr);
    54
    i = f_to_f(context, si);
    Differences
    Expression1Expression2Difference
    riVARIABLE_NAME_MISMATCH
    srsiVARIABLE_NAME_MISMATCH
    54
    i = f_to_f(context, si);
    else
    else
    49
    r = f_to_i(context, sr);
    49
    r = f_to_i(context, sr);
    55
    i = f_to_i(context, si);
    Differences
    Expression1Expression2Difference
    riVARIABLE_NAME_MISMATCH
    srsiVARIABLE_NAME_MISMATCH
    55
    i = f_to_i(context, si);
    Precondition Violations (0)
    Row Violation