File path: /jruby-1.4.0/src/org/jruby/RubyFloat.java | File path: /jruby-1.4.0/src/org/jruby/RubyFloat.java | |||
Method name: IRubyObject op_plus(ThreadContext, IRubyObject)
|
Method name: int compareTo(IRubyObject)
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | switch (other.getMetaClass().index) {↵ | 1 | switch (other.getMetaClass().index) {↵ | |
2 | case ClassIndex.FIXNUM:↵ | 2 | case ClassIndex.FIXNUM:↵ | |
3 | case ClassIndex.BIGNUM:↵ | 3 | case ClassIndex.BIGNUM:↵ | |
4 | case ClassIndex.FLOAT:↵ | 4 | case ClassIndex.FLOAT:↵ | |
5 | return RubyFloat.newFloat(getRuntime(), value + ((RubyNumeric) other).getDoubleValue());↵ | 5 | return Double.compare(value, ((RubyNumeric) other).getDoubleValue());↵ | |
6 | default:↵ | 6 | default:↵ | |
7 | return coerceBin(context, "+", other);↵ | 7 | return (int)coerceCmp(getRuntime().getCurrentContext(), "<=>", other).convertToInteger().getLongValue();↵ | |
8 | } | 8 |
| |
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.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 25 |
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 1.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||
---|---|---|---|---|---|---|---|
1 | switch (other.getMetaClass().index) | 1 | switch (other.getMetaClass().index) | ||||
2 | case ClassIndex.FIXNUM: | 2 | case ClassIndex.FIXNUM: | ||||
3 | case ClassIndex.BIGNUM: | 3 | case ClassIndex.BIGNUM: | ||||
4 | case ClassIndex.FLOAT: | 4 | case ClassIndex.FLOAT: | ||||
|
| 5 | return Double.compare(value, ((RubyNumeric)other).getDoubleValue()); | ||||
5 | return RubyFloat.newFloat(getRuntime(), value + ((RubyNumeric)other).getDoubleValue()); |
| | ||||
6 | default: | 6 | default: | ||||
|
| 7 | return (int)coerceCmp(getRuntime().getCurrentContext(), "<=>", other).convertToInteger().getLongValue(); | ||||
7 | return coerceBin(context, "+", other); |
| |
Row | Violation |
---|---|
1 | Unmatched return Double.compare(value,((RubyNumeric)other).getDoubleValue()); |
2 | Unmatched return RubyFloat.newFloat(getRuntime(),value + ((RubyNumeric)other).getDoubleValue()); |
3 | Unmatched return (int)coerceCmp(getRuntime().getCurrentContext(),"<=>",other).convertToInteger().getLongValue(); |
4 | Unmatched return coerceBin(context,"+",other); |