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();
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 22 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 7 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 2.1 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
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 | RubyBigDecimal res = handleMinusSpecialValues(val); | | 4 | RubyBigDecimal res = handleMinusSpecialValues(val); |
5 | if (res != null) | | 5 | if (res != null) |
6 | | | 6 | |
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 |