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
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are declared in the same class
Number of node comparisons12
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    if (pos < 0)
    4
    if (pos < 0)
    4
    pos += strLength();
    4
    pos += strLength();
    5
    pos += length;
    Differences
    Expression1Expression2Difference
    strLength()lengthTYPE_COMPATIBLE_REPLACEMENT
    5
    pos += length;
    5
    if (pos < 0)
    6
    if (pos < 0)
    6
    if (arg0 instanceof RubyRegexp)
    7
    if (arg0 instanceof RubyRegexp)
    7
    context.getCurrentScope().setBackRef(runtime.getNil());
    8
    context.getCurrentScope().setBackRef(runtime.getNil());
    8
    return runtime.getNil();
    9
    return runtime.getNil();
    Precondition Violations (0)
    Row Violation