File path: /jruby-1.4.0/src/org/jruby/RubyArray.java | File path: /jruby-1.4.0/src/org/jruby/RubyArray.java | |||
Method name: IRubyObject assoc(ThreadContext, IRubyObject)
|
Method name: IRubyObject rassoc(ThreadContext, IRubyObject)
|
|||
Number of AST nodes: 8 | Number of AST nodes: 8 | |||
1 | Ruby runtime = context.getRuntime();↵ | 1 | Ruby runtime = context.getRuntime();↵ | |
2 | for (int i = begin; i < begin + realLength; i++) {↵ | 2 | for (int i = begin; i < begin + realLength; i++) {↵ | |
3 | IRubyObject v = values[i];↵ | 3 | IRubyObject v = values[i];↵ | |
4 | if (v instanceof RubyArray) {↵ | 4 | if (v instanceof RubyArray) {↵ | |
5 | RubyArray arr = (RubyArray)v;↵ | 5 | RubyArray arr = (RubyArray)v;↵ | |
6 | if (arr.realLength > 0 && equalInternal(context, arr.values[arr.begin], key)) return arr;↵ | 6 | if (arr.realLength > 1 && equalInternal(context, arr.values[arr.begin + 1], value)) return arr;↵ | |
7 | }↵ | 7 | }↵ | |
8 | }↵ | 8 | }↵ | |
9 | return runtime.getNil(); | 9 |
| |
See real code fragment | See real code fragment |
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.8 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 16 |
Number of mapped statements | 8 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Ruby runtime = context.getRuntime(); | 1 | Ruby runtime = context.getRuntime(); | |||||||||||||||||||
2 | for (int i = begin; i < begin + realLength; i++) | 2 | for (int i = begin; i < begin + realLength; i++) | |||||||||||||||||||
3 | IRubyObject v = values[i]; | 3 | IRubyObject v = values[i]; | |||||||||||||||||||
4 | if (v instanceof RubyArray) | 4 | if (v instanceof RubyArray) | |||||||||||||||||||
5 | RubyArray arr = (RubyArray)v; | 5 | RubyArray arr = (RubyArray)v; | |||||||||||||||||||
6 | if (arr.realLength > 0 && equalInternal(context, arr.values[arr.begin], key)) |
| 6 | if (arr.realLength > 1 && equalInternal(context, arr.values[arr.begin + 1], value)) | ||||||||||||||||||
7 | return arr; | 7 | return arr; | |||||||||||||||||||
8 | return runtime.getNil(); | 8 | return runtime.getNil(); |
Row | Violation |
---|---|
1 | Expression arr.begin cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression arr.begin + 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |