RubyBigDecimal val = getVpValue(arg, false); if(val == null) { return callCoerced(context, "-", arg); } RubyBigDecimal res = handleMinusSpecialValues(val); if (res != null) { return res; } return new RubyBigDecimal(getRuntime(),value.subtract(val.value)).setResult();
RubyBigDecimal val = getVpValue(b, false); if(val == null) { return callCoerced(context, "-", b); } RubyBigDecimal res = handleMinusSpecialValues(val); if (res != null) { return res; } return new RubyBigDecimal(getRuntime(),value.subtract(val.value)).setResult();
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyBigDecimal.java File path: /jruby-1.4.0/src/org/jruby/RubyBigDecimal.java
Method name: IRubyObject op_minus(ThreadContext, IRubyObject) Method name: IRubyObject sub2(ThreadContext, IRubyObject, IRubyObject)
Number of AST nodes: 7 Number of AST nodes: 7
1
RubyBigDecimal val = getVpValue(arg, false);
1
RubyBigDecimal val = getVpValue(b, false);
2
        if(val == null) {
2
        if(val == null) {
3
            return callCoerced(context, "-", arg);
3
            return callCoerced(context, "-", b);
4
        }
4
        }
5
        RubyBigDecimal res = handleMinusSpecialValues(val);
5
        RubyBigDecimal res = handleMinusSpecialValues(val);
6
        if (res != null) {
6
        if (res != null) {
7
            return res;
7
            return res;
8
        }
8
        }
9
        return new RubyBigDecimal(getRuntime(),value.subtract(val.value)).setResult();
9
        return new RubyBigDecimal(getRuntime(),value.subtract(val.value)).setResult();
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)0.4
Clones locationClones are declared in the same class
Number of node comparisons22
  1. {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)2.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    RubyBigDecimal val = getVpValue(arg, false);
    1
    RubyBigDecimal val = getVpValue(arg, false);
    1
    RubyBigDecimal val = getVpValue(b, false);
    Differences
    Expression1Expression2Difference
    argbVARIABLE_NAME_MISMATCH
    1
    RubyBigDecimal val = getVpValue(b, false);
    2
    if (val == null)
    2
    if (val == null)
    3
    return callCoerced(context, "-", arg);
    3
    return callCoerced(context, "-", arg);
    3
    return callCoerced(context, "-", b);
    Differences
    Expression1Expression2Difference
    argbVARIABLE_NAME_MISMATCH
    3
    return callCoerced(context, "-", b);
    4
    RubyBigDecimal res = handleMinusSpecialValues(val);
    4
    RubyBigDecimal res = handleMinusSpecialValues(val);
    5
    if (res != null)
    5
    if (res != null)
    6
    return res;
    6
    return res;
    7
    return new RubyBigDecimal(getRuntime(), value.subtract(val.value)).setResult();
    7
    return new RubyBigDecimal(getRuntime(), value.subtract(val.value)).setResult();
    Precondition Violations (0)
    Row Violation