other = other.convertToInteger(); if (other instanceof RubyBignum) { return bignorm(getRuntime(), value.or(((RubyBignum) other).value)); } if (other instanceof RubyFixnum) { // no bignorm here needed return bignorm(getRuntime(), value.or(fix2big((RubyFixnum)other))); } return coerceBin(context, "|", other);
other = other.convertToInteger(); if (other instanceof RubyBignum) { return bignorm(getRuntime(), value.xor(((RubyBignum) other).value)); } if (other instanceof RubyFixnum) { return bignorm(getRuntime(), value.xor(BigInteger.valueOf(((RubyFixnum) other).getLongValue()))); } return coerceBin(context, "^", other);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyBignum.java File path: /jruby-1.4.0/src/org/jruby/RubyBignum.java
Method name: IRubyObject op_or(ThreadContext, IRubyObject) Method name: IRubyObject op_xor(ThreadContext, IRubyObject)
Number of AST nodes: 6 Number of AST nodes: 6
1
other = other.convertToInteger();
1
other = other.convertToInteger();
2
        if (other instanceof RubyBignum) {
2
        if (other instanceof RubyBignum) {
3
            return bignorm(getRuntime(), value.or(((RubyBignum) other).value));
3
            return bignorm(getRuntime(), value.xor(((RubyBignum) other).value));
4
        }
4
        }
5
        if (other instanceof RubyFixnum) { // no bignorm here needed
5
        if (other instanceof RubyFixnum) {
6
            return bignorm(getRuntime(), value.or(fix2big((RubyFixnum)other)));
6
            return bignorm(getRuntime(), value.xor(BigInteger.valueOf(((RubyFixnum) other).getLongValue())));
7
        }
7
        }
8
        return coerceBin(context, "|", other);
8
        return coerceBin(context, "^", other);
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.3
Clones locationClones are declared in the same class
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    other = other.convertToInteger();
    1
    other = other.convertToInteger();
    2
    if (other instanceof RubyBignum)
    2
    if (other instanceof RubyBignum)
    3
    return bignorm(getRuntime(), value.or(((RubyBignum)other).value));
    3
    return bignorm(getRuntime(), value.or(((RubyBignum)other).value));
    3
    return bignorm(getRuntime(), value.xor(((RubyBignum)other).value));
    Differences
    Expression1Expression2Difference
    orxorMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression value.or(((RubyBignum)other).value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression value.xor(((RubyBignum)other).value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    return bignorm(getRuntime(), value.xor(((RubyBignum)other).value));
    4
    if (other instanceof RubyFixnum)
    4
    if (other instanceof RubyFixnum)
                                                                                                                                                                                                        
    5
    return bignorm(getRuntime(), value.xor(BigInteger.valueOf(((RubyFixnum)other).getLongValue())));
    Preondition Violations
    Unmatched statement return bignorm(getRuntime(),value.xor(BigInteger.valueOf(((RubyFixnum)other).getLongValue()))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return bignorm(getRuntime(),value.xor(BigInteger.valueOf(((RubyFixnum)other).getLongValue())));
    5
    return bignorm(getRuntime(), value.xor(BigInteger.valueOf(((RubyFixnum)other).getLongValue())));
    5
    return bignorm(getRuntime(), value.or(fix2big((RubyFixnum)other)));
    5
    return bignorm(getRuntime(), value.or(fix2big((RubyFixnum)other)));
    Preondition Violations
    Unmatched statement return bignorm(getRuntime(),value.or(fix2big((RubyFixnum)other))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return bignorm(getRuntime(),value.or(fix2big((RubyFixnum)other)));
                                                                                                                                              
    6
    return coerceBin(context, "|", other);
    6
    return coerceBin(context, "|", other);
    6
    return coerceBin(context, "^", other);
    Differences
    Expression1Expression2Difference
    "|""^"LITERAL_VALUE_MISMATCH
    6
    return coerceBin(context, "^", other);
    Precondition Violations (6)
    Row Violation
    1Expression value.or(((RubyBignum)other).value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression value.xor(((RubyBignum)other).value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement return bignorm(getRuntime(),value.xor(BigInteger.valueOf(((RubyFixnum)other).getLongValue()))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched return bignorm(getRuntime(),value.xor(BigInteger.valueOf(((RubyFixnum)other).getLongValue())));
    5Unmatched statement return bignorm(getRuntime(),value.or(fix2big((RubyFixnum)other))); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched return bignorm(getRuntime(),value.or(fix2big((RubyFixnum)other)));