if (other instanceof RubyFixnum) { return subtractFixnum(((RubyFixnum)other).getLongValue()); } else if (other instanceof RubyBignum) { return subtractBignum(((RubyBignum)other).value); } else if (other instanceof RubyFloat) { return subtractFloat((RubyFloat)other); } return subtractOther(context, other);
if (other instanceof RubyFixnum) { return addFixnum(((RubyFixnum)other).getLongValue()); } else if (other instanceof RubyBignum) { return addBignum(((RubyBignum)other).value); } else if (other instanceof RubyFloat) { return addFloat((RubyFloat)other); } return addOther(context, other);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyBignum.java File path: /jruby-1.4.0/src/org/jruby/RubyBignum.java
Method name: IRubyObject op_minus(ThreadContext, IRubyObject) Method name: IRubyObject op_plus(ThreadContext, IRubyObject)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (other instanceof RubyFixnum) {
1
if (other instanceof RubyFixnum) {
2
            return subtractFixnum(((RubyFixnum)other).getLongValue());
2
            return addFixnum(((RubyFixnum)other).getLongValue());
3
        } else if (other instanceof RubyBignum) {
3
        } else if (other instanceof RubyBignum) {
4
            return subtractBignum(((RubyBignum)other).value);
4
            return addBignum(((RubyBignum)other).value);
5
        } else if (other instanceof RubyFloat) {
5
        } else if (other instanceof RubyFloat) {
6
            return subtractFloat((RubyFloat)other);
6
            return addFloat((RubyFloat)other);
7
        }
7
        }
8
        return subtractOther(context, other);
8
        return addOther(context, other);
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.6
Clones locationClones are declared in the same class
Number of node comparisons28
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)59.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (other instanceof RubyFixnum)
    1
    if (other instanceof RubyFixnum)
    2
    return subtractFixnum(((RubyFixnum)other).getLongValue());
    2
    return subtractFixnum(((RubyFixnum)other).getLongValue());
    2
    return addFixnum(((RubyFixnum)other).getLongValue());
    Differences
    Expression1Expression2Difference
    subtractFixnumaddFixnumMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression subtractFixnum(((RubyFixnum)other).getLongValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method subtractFixnum
    Expression addFixnum(((RubyFixnum)other).getLongValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method addFixnum
    2
    return addFixnum(((RubyFixnum)other).getLongValue());
    3
    else if (other instanceof RubyBignum)
    3
    else if (other instanceof RubyBignum)
    4
    return subtractBignum(((RubyBignum)other).value);
    4
    return subtractBignum(((RubyBignum)other).value);
    4
    return addBignum(((RubyBignum)other).value);
    Differences
    Expression1Expression2Difference
    subtractBignumaddBignumMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression subtractBignum(((RubyBignum)other).value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method subtractBignum
    Expression addBignum(((RubyBignum)other).value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method addBignum
    4
    return addBignum(((RubyBignum)other).value);
    5
    else if (other instanceof RubyFloat)
    5
    else if (other instanceof RubyFloat)
    6
    return subtractFloat((RubyFloat)other);
    6
    return subtractFloat((RubyFloat)other);
    6
    return addFloat((RubyFloat)other);
    Differences
    Expression1Expression2Difference
    subtractFloataddFloatMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression subtractFloat((RubyFloat)other) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method subtractFloat
    Expression addFloat((RubyFloat)other) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method addFloat
    6
    return addFloat((RubyFloat)other);
    7
    return subtractOther(context, other);
    7
    return subtractOther(context, other);
    7
    return addOther(context, other);
    Differences
    Expression1Expression2Difference
    subtractOtheraddOtherMETHOD_INVOCATION_NAME_MISMATCH
    7
    return addOther(context, other);
    Precondition Violations (6)
    Row Violation
    1Expression subtractFixnum(((RubyFixnum)other).getLongValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression addFixnum(((RubyFixnum)other).getLongValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression subtractBignum(((RubyBignum)other).value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression addBignum(((RubyBignum)other).value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression subtractFloat((RubyFloat)other) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression addFloat((RubyFloat)other) cannot be parameterized, because it has dependencies to/from statements that will be extracted