switch (totalArgs) { case 0: return IRubyObject.NULL_ARRAY; case 1: return new IRubyObject[] {variableValueZero}; case 2: return new IRubyObject[] {variableValueZero, variableValueOne}; case 3: return new IRubyObject[] {variableValueZero, variableValueOne, variableValueTwo}; case 4: return new IRubyObject[] {variableValueZero, variableValueOne, variableValueTwo, variableValueThree}; default: throw new RuntimeException("more args requested than available variables"); }
switch (totalArgs) { case 0: return IRubyObject.NULL_ARRAY; case 1: return new IRubyObject[] {variableValueZero}; case 2: return new IRubyObject[] {variableValueZero, variableValueOne}; case 3: return new IRubyObject[] {variableValueZero, variableValueOne, variableValueTwo}; default: throw new RuntimeException("more args requested than available variables"); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/runtime/scope/FourVarDynamicScope.java File path: /jruby-1.4.0/src/org/jruby/runtime/scope/ThreeVarDynamicScope.java
Method name: IRubyObject[] getArgValues() Method name: IRubyObject[] getArgValues()
Number of AST nodes: 13 Number of AST nodes: 11
1
switch (totalArgs) {
1
switch (totalArgs) {
2
            case 0:
2
            case 0:
3
                return IRubyObject.NULL_ARRAY;
3
                return IRubyObject.NULL_ARRAY;
4
            case 1:
4
            case 1:
5
                return new IRubyObject[] {variableValueZero};
5
                return new IRubyObject[] {variableValueZero};
6
            case 2:
6
            case 2:
7
                return new IRubyObject[] {variableValueZero, variableValueOne};
7
                return new IRubyObject[] {variableValueZero, variableValueOne};
8
            case 3:
8
            case 3:
9
                return new IRubyObject[] {variableValueZero, variableValueOne, variableValueTwo};
9
                return new IRubyObject[] {variableValueZero, variableValueOne, variableValueTwo};
10
            case 4:
11
                return new IRubyObject[] {variableValueZero, variableValueOne, variableValueTwo, variableValueThree};
12
            default:
10
            default:
13
                throw new RuntimeException("more args requested than available variables");
11
                throw new RuntimeException("more args requested than available variables");
14
            }
12
            }
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 comparisons66
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    6
    switch (totalArgs)
    6
    switch (totalArgs)
    7
    case 0:
    7
    case 0:
    8
    return IRubyObject.NULL_ARRAY;
    8
    return IRubyObject.NULL_ARRAY;
    9
    case 1:
    9
    case 1:
    10
    return new IRubyObject[] {variableValueZero};
    10
    return new IRubyObject[] {variableValueZero};
    11
    case 2:
    11
    case 2:
    12
    return new IRubyObject[] {variableValueZero, variableValueOne};
    12
    return new IRubyObject[] {variableValueZero, variableValueOne};
    13
    case 3:
    13
    case 3:
    14
    return new IRubyObject[] {variableValueZero, variableValueOne, variableValueTwo};
    14
    return new IRubyObject[] {variableValueZero, variableValueOne, variableValueTwo};
    15
    case 4:
                          
    16
    return new IRubyObject[] {variableValueZero, variableValueOne, variableValueTwo, variableValueThree};
    16
    return new IRubyObject[] {variableValueZero, variableValueOne, variableValueTwo, variableValueThree};
    Preondition Violations
    Unmatched return new IRubyObject[]{variableValueZero,variableValueOne,variableValueTwo,variableValueThree};
                                                                                                                                                                                                              
    17
    default:
    15
    default:
    18
    throw new RuntimeException("more args requested than available variables");
    16
    throw new RuntimeException("more args requested than available variables");
    Precondition Violations (1)
    Row Violation
    1Unmatched return new IRubyObject[]{variableValueZero,variableValueOne,variableValueTwo,variableValueThree};