switch (other.getMetaClass().index) { case ClassIndex.FIXNUM: case ClassIndex.BIGNUM: case ClassIndex.FLOAT: return RubyFloat.newFloat(getRuntime(), Math.pow(value, ((RubyNumeric) other) .getDoubleValue())); default: return coerceBin(context, "**", other); }
switch (other.getMetaClass().index) { case ClassIndex.FIXNUM: case ClassIndex.BIGNUM: case ClassIndex.FLOAT: return Double.compare(value, ((RubyNumeric) other).getDoubleValue()); default: return (int)coerceCmp(getRuntime().getCurrentContext(), "<=>", other).convertToInteger().getLongValue(); }
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_pow(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(), Math.pow(value, ((RubyNumeric) other)
5
            return Double.compare(value, ((RubyNumeric) other)
6
                    .getDoubleValue()));
6
.getDoubleValue());
7
        default:
7
        default:
8
            return coerceBin(context, "**", other);
8
            return (int)coerceCmp(getRuntime().getCurrentContext(), "<=>", other).convertToInteger().getLongValue();
9
        }
9
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are declared in the same class
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 2
    Mapped Statements
    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());
    Preondition Violations
    Unmatched return Double.compare(value,((RubyNumeric)other).getDoubleValue());
    5
    return Double.compare(value, ((RubyNumeric)other).getDoubleValue());
    5
    return RubyFloat.newFloat(getRuntime(), Math.pow(value, ((RubyNumeric)other).getDoubleValue()));
    5
    return RubyFloat.newFloat(getRuntime(), Math.pow(value, ((RubyNumeric)other).getDoubleValue()));
    Preondition Violations
    Unmatched return RubyFloat.newFloat(getRuntime(),Math.pow(value,((RubyNumeric)other).getDoubleValue()));
                                                                                                                                                                                                      
    6
    default:
    6
    default:
                                                                                                                                                                                                                      
    7
    return (int)coerceCmp(getRuntime().getCurrentContext(), "<=>", other).convertToInteger().getLongValue();
    Preondition Violations
    Unmatched return (int)coerceCmp(getRuntime().getCurrentContext(),"<=>",other).convertToInteger().getLongValue();
    7
    return (int)coerceCmp(getRuntime().getCurrentContext(), "<=>", other).convertToInteger().getLongValue();
    7
    return coerceBin(context, "**", other);
    7
    return coerceBin(context, "**", other);
    Preondition Violations
    Unmatched return coerceBin(context,"**",other);
                                                                                    
    Precondition Violations (4)
    Row Violation
    1Unmatched return Double.compare(value,((RubyNumeric)other).getDoubleValue());
    2Unmatched return RubyFloat.newFloat(getRuntime(),Math.pow(value,((RubyNumeric)other).getDoubleValue()));
    3Unmatched return (int)coerceCmp(getRuntime().getCurrentContext(),"<=>",other).convertToInteger().getLongValue();
    4Unmatched return coerceBin(context,"**",other);