File path: /jruby-1.4.0/src/org/jruby/RubyComplex.java | File path: /jruby-1.4.0/src/org/jruby/RubyComplex.java | |||
Method name: IRubyObject op_add(ThreadContext, IRubyObject)
|
Method name: IRubyObject op_sub(ThreadContext, IRubyObject)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 6 | |||
1 | if (other instanceof RubyComplex) {↵ | 1 | if (other instanceof RubyComplex) {↵ | |
2 | RubyComplex otherComplex = (RubyComplex)other;↵ | 2 | RubyComplex otherComplex = (RubyComplex)other;↵ | |
3 | return newComplex(context, getMetaClass(), ↵ | 3 | return newComplex(context, getMetaClass(), ↵ | |
4 | f_add(context, real, otherComplex.real),↵ | 4 | f_sub(context, real, otherComplex.real),↵ | |
5 | f_add(context, image, otherComplex.image));↵ | 5 | f_sub(context, image, otherComplex.image));↵ | |
6 | } else if (other instanceof RubyNumeric && f_real_p(context, other).isTrue()) {↵ | 6 | } else if (other instanceof RubyNumeric && f_real_p(context, other).isTrue()) {↵ | |
7 | return newComplex(context, getMetaClass(), f_add(context, real, other), image);↵ | 7 | return newComplex(context, getMetaClass(), f_sub(context, real, other), image);↵ | |
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 | 21 |
Number of mapped statements | 6 |
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) | 4.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (other instanceof RubyComplex) | 1 | if (other instanceof RubyComplex) | ||||||||||||||||||
2 | RubyComplex otherComplex = (RubyComplex)other; | 2 | RubyComplex otherComplex = (RubyComplex)other; | ||||||||||||||||||
3 | return newComplex(context, getMetaClass(), f_add(context, real, otherComplex.real), f_add(context, image, otherComplex.image)); |
| 3 | return newComplex(context, getMetaClass(), f_sub(context, real, otherComplex.real), f_sub(context, image, otherComplex.image)); | |||||||||||||||||
4 | else if (other instanceof RubyNumeric && f_real_p(context, other).isTrue()) | 4 | else if (other instanceof RubyNumeric && f_real_p(context, other).isTrue()) | ||||||||||||||||||
5 | return newComplex(context, getMetaClass(), f_add(context, real, other), image); |
| 5 | return newComplex(context, getMetaClass(), f_sub(context, real, other), image); | |||||||||||||||||
6 | return coerceBin(context, "+", other); |
| 6 | return coerceBin(context, "-", other); |
Row | Violation |
---|---|
1 | Expression f_add(context,real,otherComplex.real) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression f_sub(context,real,otherComplex.real) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression f_add(context,image,otherComplex.image) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression f_sub(context,image,otherComplex.image) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression f_add(context,real,other) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression f_sub(context,real,other) cannot be parameterized, because it has dependencies to/from statements that will be extracted |