File path: /jruby-1.4.0/src/org/jruby/RubyRegexp.java | File path: /jruby-1.4.0/src/org/jruby/RubyRegexp.java | |||
Method name: int search19(ThreadContext, RubyString, int, boolean)
|
Method name: int search(ThreadContext, RubyString, int, boolean)
|
|||
Number of AST nodes: 14 | Number of AST nodes: 13 | |||
1 | check();↵ | 1 | check();↵ | |
2 | DynamicScope scope = context.getCurrentScope();↵ | 2 | DynamicScope scope = context.getCurrentScope();↵ | |
3 | ByteList value = str.getByteList();↵ | 3 | ByteList value = str.getByteList();↵ | |
4 | if (pos <= value.realSize && pos >= 0) {↵ | 4 | if (pos <= value.realSize && pos >= 0) {↵ | |
5 | int realSize = value.realSize;↵ | 5 | int realSize = value.realSize;↵ | |
6 | int begin = value.begin;↵ | 6 | int begin = value.begin;↵ | |
7 | Matcher matcher = preparePattern(str).matcher(value.bytes, begin, begin + realSize);↵ | 7 | Matcher matcher = pattern.matcher(value.bytes, begin, begin + realSize);↵ | |
8 | int result = matcher.search(begin + pos, begin + (reverse ? 0 : realSize), Option.NONE);↵ | 8 | int result = matcher.search(begin + pos, begin + (reverse ? 0 : realSize), Option.NONE);↵ | |
9 | if (result >= 0) {↵ | 9 | if (result >= 0) {↵ | |
10 | updateBackRef(context, str, scope, matcher).charOffsetUpdated = false;;↵ | 10 | updateBackRef(context, str, scope, matcher);↵ | |
11 | return result;↵ | 11 | return result;↵ | |
12 | }↵ | 12 | }↵ | |
13 | }↵ | 13 | }↵ | |
14 | scope.setBackRef(context.getRuntime().getNil());↵ | 14 | scope.setBackRef(context.getRuntime().getNil());↵ | |
15 | return -1; | 15 |
| |
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 50 |
Number of mapped statements | 12 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 3.8 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | check(); | 1 | check(); | |||||||||||
2 | DynamicScope scope = context.getCurrentScope(); | 2 | DynamicScope scope = context.getCurrentScope(); | |||||||||||
3 | ByteList value = str.getByteList(); | 3 | ByteList value = str.getByteList(); | |||||||||||
4 | if (pos <= value.realSize && pos >= 0) | 4 | if (pos <= value.realSize && pos >= 0) | |||||||||||
5 | int realSize = value.realSize; | 5 | int realSize = value.realSize; | |||||||||||
6 | int begin = value.begin; | 6 | int begin = value.begin; | |||||||||||
7 | Matcher matcher = preparePattern(str).matcher(value.bytes, begin, begin + realSize); |
| 7 | Matcher matcher = pattern.matcher(value.bytes, begin, begin + realSize); | ||||||||||
8 | int result = matcher.search(begin + pos, begin + (reverse ? 0 : realSize), Option.NONE); | 8 | int result = matcher.search(begin + pos, begin + (reverse ? 0 : realSize), Option.NONE); | |||||||||||
9 | if (result >= 0) | 9 | if (result >= 0) | |||||||||||
|
| 10 | updateBackRef(context, str, scope, matcher); | |||||||||||
10 | updateBackRef(context, str, scope, matcher).charOffsetUpdated = false; |
| | |||||||||||
11 | ; | | ||||||||||||
12 | return result; | 11 | return result; | |||||||||||
13 | scope.setBackRef(context.getRuntime().getNil()); | 12 | scope.setBackRef(context.getRuntime().getNil()); | |||||||||||
14 | return -1; | 13 | return -1; |
Row | Violation |
---|---|
1 | Unmatched statement updateBackRef(context,str,scope,matcher); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement updateBackRef(context,str,scope,matcher).charOffsetUpdated=false; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Clone fragment #1 returns variables scope, matcher , while Clone fragment #2 returns variables scope, matcher |