switch (other.getMetaClass().index) {
case ClassIndex.FIXNUM:
case ClassIndex.BIGNUM:
case ClassIndex.FLOAT:
double b = ((RubyNumeric) other).getDoubleValue();
return RubyBoolean.newBoolean(getRuntime(), !Double.isNaN(b) && value < b);
default:
return coerceRelOp(context, "<", other);
}
switch (other.getMetaClass().index) {
case ClassIndex.FIXNUM:
case ClassIndex.BIGNUM:
case ClassIndex.FLOAT:
double b = ((RubyNumeric) other).getDoubleValue();
return RubyBoolean.newBoolean(getRuntime(), !Double.isNaN(b) && value > b);
default:
return coerceRelOp(context, ">", other);
}
Clone fragments detected by clone detection tool
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_lt(ThreadContext, IRubyObject)
|
|
Method name: IRubyObject op_gt(ThreadContext, IRubyObject)
|
Number of AST nodes: 8
|
|
Number of AST nodes: 8
|
|
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 | double b = ((RubyNumeric) other).getDoubleValue();↵ | | 5 | double b = ((RubyNumeric) other).getDoubleValue();↵
|
6 | return RubyBoolean.newBoolean(getRuntime(), !Double.isNaN(b) && value < b);↵ | | 6 | return RubyBoolean.newBoolean(getRuntime(), !Double.isNaN(b) && value > b);↵
|
7 | default:↵ | | 7 | default:↵
|
8 | return coerceRelOp(context, "<", other);↵ | | 8 | return coerceRelOp(context, ">", other);↵
|
9 | } | | 9 | }
|
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.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 33 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 7 |
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.7 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | switch (other.getMetaClass().index) | | 1 | switch (other.getMetaClass().index) |
2 | | | 2 | |
3 | | | 3 | |
4 | | | 4 | |
5 | double b = ((RubyNumeric)other).getDoubleValue(); | | 5 | double b = ((RubyNumeric)other).getDoubleValue(); |
| | | 6 | return RubyBoolean.newBoolean(getRuntime(), !Double.isNaN(b) && value > b); |
6 | return RubyBoolean.newBoolean(getRuntime(), !Double.isNaN(b) && value < b); | | | |
7 | | | 7 | |
8 | return coerceRelOp(context, "<", other); | | 8 | return coerceRelOp(context, ">", other); |
Precondition Violations (0)
Row |
Violation |