File path: /jruby-1.4.0/src/org/jruby/RubyArray.java | File path: /jruby-1.4.0/src/org/jruby/RubyArray.java | |||
Method name: RubyArray makeSharedFirst(ThreadContext, IRubyObject, boolean, RubyClass)
|
Method name: RubyArray makeSharedFirst(ThreadContext, IRubyObject, boolean)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 6 | |||
1 | int n = RubyNumeric.num2int(num);↵ | 1 | int n = RubyNumeric.num2int(num);↵ | |
2 | ↵ | 2 | ↵ | |
3 | if (n > realLength) {↵ | 3 | if (n > realLength) {↵ | |
4 | n = realLength;↵ | 4 | n = realLength;↵ | |
5 | } else if (n < 0) {↵ | 5 | } else if (n < 0) {↵ | |
6 | throw context.getRuntime().newArgumentError("negative array size");↵ | 6 | throw context.getRuntime().newArgumentError("negative array size");↵ | |
7 | }↵ | 7 | }↵ | |
8 | ↵ | 8 | ↵ | |
9 | return makeShared(last ? realLength - n : 0, n, klass); | 9 | return makeShared(last ? realLength - n : 0, n, getMetaClass()); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 17 |
Number of mapped statements | 6 |
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.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | int n = RubyNumeric.num2int(num); | 1 | int n = RubyNumeric.num2int(num); | |||||||||||
2 | if (n > realLength) | 2 | if (n > realLength) | |||||||||||
3 | n = realLength; | 3 | n = realLength; | |||||||||||
4 | else if (n < 0) | 4 | else if (n < 0) | |||||||||||
5 | throw context.getRuntime().newArgumentError("negative array size"); | 5 | throw context.getRuntime().newArgumentError("negative array size"); | |||||||||||
6 | return makeShared(last ? realLength - n : 0, n, klass); |
| 6 | return makeShared(last ? realLength - n : 0, n, getMetaClass()); |
Row | Violation |
---|