File path: /jruby-1.4.0/src/org/jruby/RubyRational.java | File path: /jruby-1.4.0/src/org/jruby/RubyRational.java | |||
Method name: IRubyObject op_add(ThreadContext, IRubyObject)
|
Method name: IRubyObject op_mul(ThreadContext, IRubyObject)
|
|||
Number of AST nodes: 8 | Number of AST nodes: 8 | |||
1 | if (other instanceof RubyFixnum || other instanceof RubyBignum) {↵ | 1 | if (other instanceof RubyFixnum || other instanceof RubyBignum) {↵ | |
2 | return f_addsub(context, num, den, other, RubyFixnum.one(context.getRuntime()), true);↵ | 2 | return f_muldiv(context, num, den, other, RubyFixnum.one(context.getRuntime()), true);↵ | |
3 | } else if (other instanceof RubyFloat) {↵ | 3 | } else if (other instanceof RubyFloat) {↵ | |
4 | return f_add(context, f_to_f(context, this), other);↵ | 4 | return f_mul(context, f_to_f(context, this), other);↵ | |
5 | } else if (other instanceof RubyRational) {↵ | 5 | } else if (other instanceof RubyRational) {↵ | |
6 | RubyRational otherRational = (RubyRational)other;↵ | 6 | RubyRational otherRational = (RubyRational)other;↵ | |
7 | return f_addsub(context, num, den, otherRational.num, otherRational.den, true);↵ | 7 | return f_muldiv(context, num, den, otherRational.num, otherRational.den, true);↵ | |
8 | } ↵ | 8 | }↵ | |
9 | return coerceBin(context, "+", other); | 9 | return coerceBin(context, "*", other); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
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 | 37 |
Number of mapped statements | 8 |
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) | 61.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (other instanceof RubyFixnum || other instanceof RubyBignum) | 1 | if (other instanceof RubyFixnum || other instanceof RubyBignum) | |||||||||||||
2 | return f_addsub(context, num, den, other, RubyFixnum.one(context.getRuntime()), true); |
| 2 | return f_muldiv(context, num, den, other, RubyFixnum.one(context.getRuntime()), true); | ||||||||||||
3 | else if (other instanceof RubyFloat) | 3 | else if (other instanceof RubyFloat) | |||||||||||||
4 | return f_add(context, f_to_f(context, this), other); |
| 4 | return f_mul(context, f_to_f(context, this), other); | ||||||||||||
5 | else if (other instanceof RubyRational) | 5 | else if (other instanceof RubyRational) | |||||||||||||
6 | RubyRational otherRational = (RubyRational)other; | 6 | RubyRational otherRational = (RubyRational)other; | |||||||||||||
7 | return f_addsub(context, num, den, otherRational.num, otherRational.den, true); |
| 7 | return f_muldiv(context, num, den, otherRational.num, otherRational.den, true); | ||||||||||||
8 | return coerceBin(context, "+", other); |
| 8 | return coerceBin(context, "*", other); |
Row | Violation |
---|---|
1 | Expression f_addsub(context,num,den,other,RubyFixnum.one(context.getRuntime()),true) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression f_muldiv(context,num,den,other,RubyFixnum.one(context.getRuntime()),true) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression f_add(context,f_to_f(context,this),other) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression f_mul(context,f_to_f(context,this),other) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression f_addsub(context,num,den,otherRational.num,otherRational.den,true) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression f_muldiv(context,num,den,otherRational.num,otherRational.den,true) cannot be parameterized, because it has dependencies to/from statements that will be extracted |