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 m_cos(ThreadContext, IRubyObject)
|
Method name: IRubyObject m_sin(ThreadContext, IRubyObject)
|
|||
Number of AST nodes: 4 | Number of AST nodes: 4 | |||
1 | if (f_real_p(context, x).isTrue()) return RubyMath.cos(x, x);↵ | 1 | if (f_real_p(context, x).isTrue()) return RubyMath.sin(x, x);↵ | |
2 | RubyComplex complex = (RubyComplex)x;↵ | 2 | RubyComplex complex = (RubyComplex)x;↵ | |
3 | return newComplex(context, context.getRuntime().getComplex(),↵ | 3 | return newComplex(context, context.getRuntime().getComplex(),↵ | |
4 | f_mul(context, RubyMath.cos(x, complex.real), RubyMath.cosh(x, complex.image)),↵ | 4 | f_mul(context, RubyMath.sin(x, complex.real), RubyMath.cosh(x, complex.image)),↵ | |
5 | f_mul(context, f_negate(context, RubyMath.sin(x, complex.real)), RubyMath.sinh(x, complex.image))); | 5 | f_mul(context, RubyMath.cos(x, complex.real), RubyMath.sinh(x, complex.image))); | |
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.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 8 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (f_real_p(context, x).isTrue()) | 1 | if (f_real_p(context, x).isTrue()) | |||||||||||
2 | return RubyMath.cos(x, x); |
| 2 | return RubyMath.sin(x, x); | ||||||||||
3 | RubyComplex complex = (RubyComplex)x; | 3 | RubyComplex complex = (RubyComplex)x; | |||||||||||
|
| 4 | return newComplex(context, context.getRuntime().getComplex(), f_mul(context, RubyMath.sin(x, complex.real), RubyMath.cosh(x, complex.image)), f_mul(context, RubyMath.cos(x, complex.real), RubyMath.sinh(x, complex.image))); | |||||||||||
4 | return newComplex(context, context.getRuntime().getComplex(), f_mul(context, RubyMath.cos(x, complex.real), RubyMath.cosh(x, complex.image)), f_mul(context, f_negate(context, RubyMath.sin(x, complex.real)), RubyMath.sinh(x, complex.image))); |
| |
Row | Violation |
---|---|
1 | Unmatched statement return newComplex(context,context.getRuntime().getComplex(),f_mul(context,RubyMath.sin(x,complex.real),RubyMath.cosh(x,complex.image)),f_mul(context,RubyMath.cos(x,complex.real),RubyMath.sinh(x,complex.image))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched return newComplex(context,context.getRuntime().getComplex(),f_mul(context,RubyMath.sin(x,complex.real),RubyMath.cosh(x,complex.image)),f_mul(context,RubyMath.cos(x,complex.real),RubyMath.sinh(x,complex.image))); |
3 | Unmatched statement return newComplex(context,context.getRuntime().getComplex(),f_mul(context,RubyMath.cos(x,complex.real),RubyMath.cosh(x,complex.image)),f_mul(context,f_negate(context,RubyMath.sin(x,complex.real)),RubyMath.sinh(x,complex.image))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched return newComplex(context,context.getRuntime().getComplex(),f_mul(context,RubyMath.cos(x,complex.real),RubyMath.cosh(x,complex.image)),f_mul(context,f_negate(context,RubyMath.sin(x,complex.real)),RubyMath.sinh(x,complex.image))); |