File path: /jruby-1.4.0/src/org/jruby/RubyString.java | File path: /jruby-1.4.0/src/org/jruby/RubyString.java | |||
Method name: RubyArray regexSplit19(ThreadContext, Regex, Regex, boolean, int, int)
|
Method name: RubyArray regexSplit(ThreadContext, IRubyObject, boolean, int, int)
|
|||
Number of AST nodes: 19 | Number of AST nodes: 19 | |||
1 | while ((end = matcher.search(start, range, Option.NONE)) >= 0) {↵ | 1 | while ((end = matcher.search(start, range, Option.NONE)) >= 0) {↵ | |
2 | if (start == end + begin && matcher.getBegin() == matcher.getEnd()) {↵ | 2 | if (start == end + begin && matcher.getBegin() == matcher.getEnd()) {↵ | |
3 | if (len == 0) {↵ | 3 | if (len == 0) {↵ | |
4 | result.append(newEmptyString(runtime, getMetaClass()));↵ | 4 | result.append(newEmptyString(runtime, getMetaClass()));↵ | |
5 | break;↵ | 5 | break;↵ | |
6 | } else if (lastNull) {↵ | 6 | } else if (lastNull) {↵ | |
7 | result.append(makeShared19(runtime, beg, StringSupport.length(enc, bytes, begin + beg, range)));↵ | 7 | result.append(makeShared(runtime, beg, enc.length(bytes, begin + beg, range)));↵ | |
8 | beg = start - begin;↵ | 8 | beg = start - begin;↵ | |
9 | } else {↵ | 9 | } else {↵ | |
10 | start += start == range ? 1 : StringSupport.length(enc, bytes, start, range);↵ | 10 | start += start == range ? 1 : enc.length(bytes, start, range);↵ | |
11 | lastNull = true;↵ | 11 | lastNull = true;↵ | |
12 | continue;↵ | 12 | continue;↵ | |
13 | }↵ | 13 | }↵ | |
14 | } else {↵ | 14 | } else {↵ | |
15 | result.append(makeShared19(runtime, beg, end - beg));↵ | 15 | result.append(makeShared(runtime, beg, end - beg));↵ | |
16 | beg = matcher.getEnd();↵ | 16 | beg = matcher.getEnd();↵ | |
17 | start = begin + beg;↵ | 17 | start = begin + beg;↵ | |
18 | }↵ | 18 | }↵ | |
19 | lastNull = false;↵ | 19 | lastNull = false;↵ | |
20 | if (captures) populateCapturesForSplit(runtime, result, matcher, true);↵ | 20 | if (captures) populateCapturesForSplit(runtime, result, matcher, false);↵ | |
21 | if (limit && lim <= ++i) break;↵ | 21 | if (limit && lim <= ++i) break;↵ | |
22 | } | 22 |
| |
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) | 5.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 97 |
Number of mapped statements | 17 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 59.9 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
13 | while ((end = matcher.search(start, range, Option.NONE)) >= 0) | 14 | while ((end = matcher.search(start, range, Option.NONE)) >= 0) | |||||||||||||
14 | if (start == end + begin && matcher.getBegin() == matcher.getEnd()) | 15 | if (start == end + begin && matcher.getBegin() == matcher.getEnd()) | |||||||||||||
15 | if (len == 0) | 16 | if (len == 0) | |||||||||||||
16 | result.append(newEmptyString(runtime, getMetaClass())); | 17 | result.append(newEmptyString(runtime, getMetaClass())); | |||||||||||||
17 | break; | 18 | break; | |||||||||||||
18 | else if (lastNull) | 19 | else if (lastNull) | |||||||||||||
19 | result.append(makeShared19(runtime, beg, StringSupport.length(enc, bytes, begin + beg, range))); |
| | |||||||||||||
|
| 20 | result.append(makeShared(runtime, beg, enc.length(bytes, begin + beg, range))); | |||||||||||||
20 | beg = start - begin; | 21 | beg = start - begin; | |||||||||||||
else | else | |||||||||||||||
21 | start += start == range ? 1 : StringSupport.length(enc, bytes, start, range); |
| | |||||||||||||
|
| 22 | start += start == range ? 1 : enc.length(bytes, start, range); | |||||||||||||
22 | lastNull = true; | 23 | lastNull = true; | |||||||||||||
23 | continue; | 24 | continue; | |||||||||||||
else | else | |||||||||||||||
24 | result.append(makeShared19(runtime, beg, end - beg)); |
| 25 | result.append(makeShared(runtime, beg, end - beg)); | ||||||||||||
25 | beg = matcher.getEnd(); | 26 | beg = matcher.getEnd(); | |||||||||||||
26 | start = begin + beg; | 27 | start = begin + beg; | |||||||||||||
27 | lastNull = false; | 28 | lastNull = false; | |||||||||||||
28 | if (captures) | 29 | if (captures) | |||||||||||||
29 | populateCapturesForSplit(runtime, result, matcher, true); |
| 30 | populateCapturesForSplit(runtime, result, matcher, false); | ||||||||||||
30 | if (limit && lim <= ++i) | 31 | if (limit && lim <= ++i) | |||||||||||||
31 | break; | 32 | break; |
Row | Violation |
---|---|
1 | Unmatched statement result.append(makeShared19(runtime,beg,StringSupport.length(enc,bytes,begin + beg,range))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement result.append(makeShared(runtime,beg,enc.length(bytes,begin + beg,range))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement start+=start == range ? 1 : StringSupport.length(enc,bytes,start,range); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement start+=start == range ? 1 : enc.length(bytes,start,range); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Expression makeShared19(runtime,beg,end - beg) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression makeShared(runtime,beg,end - beg) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Clone fragment #1 returns variables beg, start , while Clone fragment #2 returns variables beg, start |