if (depth > 0) {
return parent.getValue(offset, depth - 1);
}
assert offset < SIZE : SIZE_ERROR;
switch (offset) {
case 0:
return variableValueZero;
case 1:
return variableValueOne;
case 2:
return variableValueTwo;
default:
throw new RuntimeException(SIZE_ERROR);
}
if (depth > 0) {
return parent.getValue(offset, depth - 1);
}
assert offset < SIZE : SIZE_ERROR;
switch (offset) {
case 0:
return variableValueZero;
case 1:
return variableValueOne;
default:
throw new RuntimeException(SIZE_ERROR);
}
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/runtime/scope/ThreeVarDynamicScope.java
|
|
File path: /jruby-1.4.0/src/org/jruby/runtime/scope/TwoVarDynamicScope.java
|
Method name: IRubyObject getValue(int, int)
|
|
Method name: IRubyObject getValue(int, int)
|
Number of AST nodes: 12
|
|
Number of AST nodes: 10
|
|
1 | if (depth > 0) {↵ | | 1 | if (depth > 0) {↵
|
2 | return parent.getValue(offset, depth - 1);↵ | | 2 | return parent.getValue(offset, depth - 1);↵
|
3 | }↵ | | 3 | }↵
|
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;↵ | | 7 | return variableValueZero;↵
|
8 | case 1:↵ | | 8 | case 1:↵
|
9 | return variableValueOne;↵ | | 9 | return variableValueOne;↵
|
10 | case 2:↵ | | |
|
11 | return variableValueTwo;↵ | | |
|
12 | default:↵ | | 10 | default:↵
|
13 | throw new RuntimeException(SIZE_ERROR);↵ | | 11 | throw new RuntimeException(SIZE_ERROR);↵
|
14 | } | | 12 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 49 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 10 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.6 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (depth > 0) | | 1 | if (depth > 0) |
2 | return parent.getValue(offset, depth - 1); | | 2 | return parent.getValue(offset, depth - 1); |
3 | assert offset < SIZE : SIZE_ERROR; | | 3 | assert offset < SIZE : SIZE_ERROR; |
4 | switch (offset) | | 4 | switch (offset) |
5 | | | 5 | |
6 | return variableValueZero; | | 6 | return variableValueZero; |
7 | | | 7 | |
8 | | | 8 | |
9 | | | | |
10 | | | | |
11 | | | 9 | |
12 | throw new RuntimeException(SIZE_ERROR); | | 10 | throw new RuntimeException(SIZE_ERROR); |
Precondition Violations (1)
Row |
Violation |
1 | Unmatched return variableValueTwo; |