File path: /jruby-1.4.0/src/org/jruby/RubyRange.java | File path: /jruby-1.4.0/src/org/jruby/RubyRange.java | |||
Method name: int[] begLenInt(int, int)
|
Method name: long[] begLen(long, int)
|
|||
Number of AST nodes: 23 | Number of AST nodes: 23 | |||
1 | int beg = RubyNumeric.num2int(this.begin);↵ | 1 | long beg = RubyNumeric.num2long(this.begin);↵ | |
2 | int end = RubyNumeric.num2int(this.end);↵ | 2 | long end = RubyNumeric.num2long(this.end);↵ | |
3 | if (beg < 0) {↵ | 3 | if (beg < 0) {↵ | |
4 | beg += len;↵ | 4 | beg += len;↵ | |
5 | if (beg < 0) {↵ | 5 | if (beg < 0) {↵ | |
6 | if (err != 0) throw getRuntime().newRangeError(beg + ".." + (isExclusive ? "." : "") + end + " out of range");↵ | 6 | if (err != 0) throw getRuntime().newRangeError(beg + ".." + (isExclusive ? "." : "") + end + " out of range");↵ | |
7 | return null;↵ | 7 | return null;↵ | |
8 | }↵ | 8 | }↵ | |
9 | }↵ | 9 | }↵ | |
10 | if (err == 0 || err == 2) {↵ | 10 | if (err == 0 || err == 2) {↵ | |
11 | if (beg > len) {↵ | 11 | if (beg > len) {↵ | |
12 | if (err != 0) throw getRuntime().newRangeError(beg + ".." + (isExclusive ? "." : "") + end + " out of range");↵ | 12 | if (err != 0) throw getRuntime().newRangeError(beg + ".." + (isExclusive ? "." : "") + end + " out of range");↵ | |
13 | return null;↵ | 13 | return null;↵ | |
14 | }↵ | 14 | }↵ | |
15 | if (end > len) end = len;↵ | 15 | if (end > len) end = len;↵ | |
16 | }↵ | 16 | }↵ | |
17 | if (end < 0) end += len;↵ | 17 | if (end < 0) end += len;↵ | |
18 | if (!isExclusive) end++;↵ | 18 | if (!isExclusive) end++;↵ | |
19 | len = end - beg;↵ | 19 | len = end - beg;↵ | |
20 | if (len < 0) len = 0;↵ | 20 | if (len < 0) len = 0;↵ | |
21 | return new int[]{beg, len}; | 21 | return new long[]{beg, len}; | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 2 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 2 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 1.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 73 |
Number of mapped statements | 8 |
Number of unmapped statements in the first code fragment | 14 |
Number of unmapped statements in the second code fragment | 14 |
Time elapsed for statement mapping (ms) | 4.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | long beg = RubyNumeric.num2long(this.begin); | |||||||||||||||||
1 | int beg = RubyNumeric.num2int(this.begin); | | |||||||||||||||||
| 2 | long end = RubyNumeric.num2long(this.end); | |||||||||||||||||
2 | int end = RubyNumeric.num2int(this.end); | | |||||||||||||||||
3 | if (beg < 0) |
| 3 | if (beg < 0) | |||||||||||||||
|
| 4 | beg += len; | ||||||||||||||||
4 | beg += len; |
| | ||||||||||||||||
5 | if (beg < 0) |
| 5 | if (beg < 0) | |||||||||||||||
6 | if (err != 0) | 6 | if (err != 0) | ||||||||||||||||
7 | throw getRuntime().newRangeError(beg + ".." + (isExclusive ? "." : "") + end + " out of range"); |
| 7 | throw getRuntime().newRangeError(beg + ".." + (isExclusive ? "." : "") + end + " out of range"); | |||||||||||||||
8 | return null; | 8 | return null; | ||||||||||||||||
| 9 | if (err == 0 || err == 2) | |||||||||||||||||
| 10 | if (beg > len) | |||||||||||||||||
| 11 | if (err != 0) | |||||||||||||||||
|
| 12 | throw getRuntime().newRangeError(beg + ".." + (isExclusive ? "." : "") + end + " out of range"); | ||||||||||||||||
|
| 13 | return null; | ||||||||||||||||
| 14 | if (end > len) | |||||||||||||||||
|
| 15 | end = len; | ||||||||||||||||
9 | if (err == 0 || err == 2) | | |||||||||||||||||
10 | if (beg > len) | | |||||||||||||||||
11 | if (err != 0) | | |||||||||||||||||
12 | throw getRuntime().newRangeError(beg + ".." + (isExclusive ? "." : "") + end + " out of range"); |
| | ||||||||||||||||
13 | return null; |
| | ||||||||||||||||
14 | if (end > len) | | |||||||||||||||||
15 | end = len; |
| | ||||||||||||||||
16 | if (end < 0) |
| 16 | if (end < 0) | |||||||||||||||
|
| 17 | end += len; | ||||||||||||||||
17 | end += len; |
| | ||||||||||||||||
18 | if (!isExclusive) | 18 | if (!isExclusive) | ||||||||||||||||
|
| 19 | end++; | ||||||||||||||||
19 | end++; |
| | ||||||||||||||||
| 20 | len = end - beg; | |||||||||||||||||
20 | len = end - beg; | | |||||||||||||||||
21 | if (len < 0) |
| 21 | if (len < 0) | |||||||||||||||
|
| 22 | len = 0; | ||||||||||||||||
22 | len = 0; |
| |
Row | Violation |
---|---|
1 | Type int of variable beg does not match with type long of variable beg |
2 | Unmatched statement beg+=len; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement beg+=len; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Type int of variable beg does not match with type long of variable beg |
5 | Type int of variable end does not match with type long of variable end |
6 | Type int of variable beg does not match with type long of variable beg |
7 | Unmatched throw getRuntime().newRangeError(beg + ".." + (isExclusive ? "." : "")+ end+ " out of range"); |
8 | Unmatched return null; |
9 | Unmatched statement end=len; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
10 | Unmatched throw getRuntime().newRangeError(beg + ".." + (isExclusive ? "." : "")+ end+ " out of range"); |
11 | Unmatched return null; |
12 | Unmatched statement end=len; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
13 | Type int of variable end does not match with type long of variable end |
14 | Unmatched statement end+=len; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
15 | Unmatched statement end+=len; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
16 | Unmatched statement end++; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
17 | Unmatched statement end++; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
18 | Type int of variable len does not match with type long of variable len |
19 | Unmatched statement len=0; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
20 | Unmatched statement len=0; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
Number of mapped statements | 2 |
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) | 0.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11 | if (err != 0) | 6 | if (err != 0) | ||||||||||||||||
12 | throw getRuntime().newRangeError(beg + ".." + (isExclusive ? "." : "") + end + " out of range"); |
| 7 | throw getRuntime().newRangeError(beg + ".." + (isExclusive ? "." : "") + end + " out of range"); |
Row | Violation |
---|---|
1 | Type int of variable end does not match with type long of variable end |
2 | Type int of variable beg does not match with type long of variable beg |