if (arg instanceof RubyFixnum) { return ((RubyFixnum) arg).getLongValue(); } else { return other2long(arg); }
if(val instanceof RubyNumeric) { return RubyNumeric.fix2int(val); } else { return stringAsNumber(val); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyNumeric.java File path: /jruby-1.4.0/src/org/jruby/ext/socket/RubyBasicSocket.java
Method name: long num2long(IRubyObject) Method name: int asNumber(IRubyObject)
Number of AST nodes: 3 Number of AST nodes: 3
1
if (arg instanceof RubyFixnum) {
1
if(val instanceof RubyNumeric) {
2
            return ((RubyFixnum) arg).getLongValue();
2
            return RubyNumeric.fix2int(val);
3
        } else {
3
        } else {
4
            return other2long(arg);
4
            return stringAsNumber(val);
5
        }
5
        }
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 in different classes having the same super class
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (arg instanceof RubyFixnum)
    1
    if (arg instanceof RubyFixnum)
    1
    if (val instanceof RubyNumeric)
    Differences
    Expression1Expression2Difference
    argvalVARIABLE_NAME_MISMATCH
    org.jruby.RubyFixnumorg.jruby.RubyNumericSUBCLASS_TYPE_MISMATCH
    1
    if (val instanceof RubyNumeric)
                                                                          
    2
    return RubyNumeric.fix2int(val);
    Preondition Violations
    Unmatched return RubyNumeric.fix2int(val);
    2
    return RubyNumeric.fix2int(val);
    2
    return ((RubyFixnum)arg).getLongValue();
    2
    return ((RubyFixnum)arg).getLongValue();
    Preondition Violations
    Unmatched return ((RubyFixnum)arg).getLongValue();
                                                                                          
    else
            
                                                                
    3
    return stringAsNumber(val);
    Preondition Violations
    Unmatched return stringAsNumber(val);
    3
    return stringAsNumber(val);
    3
    return other2long(arg);
    3
    return other2long(arg);
    Preondition Violations
    Unmatched return other2long(arg);
                                                        
    Precondition Violations (4)
    Row Violation
    1Unmatched return RubyNumeric.fix2int(val);
    2Unmatched return ((RubyFixnum)arg).getLongValue();
    3Unmatched return stringAsNumber(val);
    4Unmatched return other2long(arg);