if (pos < 0) {
pos += strLength();
if (pos < 0) {
if (arg0 instanceof RubyRegexp) context.getCurrentScope().setBackRef(runtime.getNil());
return runtime.getNil();
}
}
if (pos < 0) {
pos += length;
if (pos < 0) {
if (arg0 instanceof RubyRegexp) context.getCurrentScope().setBackRef(runtime.getNil());
return runtime.getNil();
}
}
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyString.java
|
|
File path: /jruby-1.4.0/src/org/jruby/RubyString.java
|
Method name: IRubyObject index19(ThreadContext, IRubyObject, IRubyObject)
|
|
Method name: IRubyObject rindex19(ThreadContext, IRubyObject, IRubyObject)
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | if (pos < 0) {↵ | | 1 | if (pos < 0) {↵
|
2 | pos += strLength();↵ | | 2 | pos += length;↵
|
3 | if (pos < 0) {↵ | | 3 | if (pos < 0) {↵
|
4 | if (arg0 instanceof RubyRegexp) context.getCurrentScope().setBackRef(runtime.getNil());↵ | | 4 | if (arg0 instanceof RubyRegexp) context.getCurrentScope().setBackRef(runtime.getNil());↵
|
5 | return runtime.getNil();↵ | | 5 | return runtime.getNil();↵
|
6 | }↵ | | 6 | }↵
|
7 | } | | 7 | }
|
See real code fragment |
|
See real code fragment |
Summary
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 12 |
-
{Refactorable}
Mapping Summary
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 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | if (pos < 0) | | 4 | if (pos < 0) |
4 | | | 5 | |
5 | | | 6 | |
6 | if (arg0 instanceof RubyRegexp) | | 7 | if (arg0 instanceof RubyRegexp) |
7 | context.getCurrentScope().setBackRef(runtime.getNil()); | | 8 | context.getCurrentScope().setBackRef(runtime.getNil()); |
8 | | | 9 | |
Precondition Violations (0)
Row |
Violation |