if (depth > 0) { assert parent != null : "If depth > 0, then parent should not ever be null"; return parent.setValue(offset, value, depth - 1); } else { assert offset < SIZE : SIZE_ERROR; switch (offset) { case 0: return variableValueZero = value; case 1: return variableValueOne = value; case 2: return variableValueTwo = value; case 3: return variableValueThree = value; default: throw new RuntimeException(SIZE_ERROR); } }
if (depth > 0) { assert parent != null : "If depth > 0, then parent should not ever be null"; return parent.setValue(offset, value, depth - 1); } else { assert offset < SIZE : SIZE_ERROR; switch (offset) { case 0: return variableValueZero = value; case 1: return variableValueOne = value; case 2: return variableValueTwo = value; default: throw new RuntimeException(SIZE_ERROR); } }
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 setValue(int, IRubyObject, int) Method name: IRubyObject setValue(int, IRubyObject, int)
Number of AST nodes: 15 Number of AST nodes: 13
1
if (depth > 0) {
1
if (depth > 0) {
2
            assert parent != null : "If depth > 0, then parent should not ever be null";
2
            assert parent != null : "If depth > 0, then parent should not ever be null";
3
            
3
            
4
            return parent.setValue(offset, value, depth - 1);
4
            return parent.setValue(offset, value, depth - 1);
5
        } else {
5
        } else {
6
            assert offset < SIZE : SIZE_ERROR;
6
            assert offset < SIZE : SIZE_ERROR;
7
            switch (offset) {
7
            switch (offset) {
8
            case 0:
8
            case 0:
9
                return variableValueZero = value;
9
                return variableValueZero = value;
10
            case 1:
10
            case 1:
11
                return variableValueOne = value;
11
                return variableValueOne = value;
12
            case 2:
12
            case 2:
13
                return variableValueTwo = value;
13
                return variableValueTwo = value;
14
            case 3:
15
                return variableValueThree = value;
16
            default:
14
            default:
17
                throw new RuntimeException(SIZE_ERROR);
15
                throw new RuntimeException(SIZE_ERROR);
18
            }
16
            }
19
        }
17
        }
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.1
Clones locationClones are in different classes having the same super class
Number of node comparisons61
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.1
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (depth > 0)
    1
    if (depth > 0)
    2
    assert parent != null : "If depth > 0, then parent should not ever be null";
    2
    assert parent != null : "If depth > 0, then parent should not ever be null";
    3
    return parent.setValue(offset, value, depth - 1);
    3
    return parent.setValue(offset, value, depth - 1);
    else
    else
    4
    assert offset < SIZE : SIZE_ERROR;
    4
    assert offset < SIZE : SIZE_ERROR;
    5
    switch (offset)
    5
    switch (offset)
    6
    case 0:
    6
    case 0:
    7
    return variableValueZero = value;
    7
    return variableValueZero = value;
    8
    case 1:
    8
    case 1:
    9
    return variableValueOne = value;
    9
    return variableValueOne = value;
    10
    case 2:
    10
    case 2:
    11
    return variableValueTwo = value;
    11
    return variableValueTwo = value;
    12
    case 3:
                          
    13
    return variableValueThree = value;
    13
    return variableValueThree = value;
    Preondition Violations
    Unmatched return variableValueThree=value;
                                                                            
    14
    default:
    12
    default:
    15
    throw new RuntimeException(SIZE_ERROR);
    13
    throw new RuntimeException(SIZE_ERROR);
    Precondition Violations (1)
    Row Violation
    1Unmatched return variableValueThree=value;