int i = backrefNumber(index); Ruby runtime = context.getRuntime(); int b = beginCommon(runtime, i); if (b < 0) return runtime.getNil(); if (!str.singleByteOptimizable()) { updateCharOffset(); b = charOffsets.beg[i]; } return RubyFixnum.newFixnum(runtime, b);
int i = backrefNumber(index); Ruby runtime = context.getRuntime(); int e = endCommon(runtime, i); if (e < 0) return runtime.getNil(); if (!str.singleByteOptimizable()) { updateCharOffset(); e = charOffsets.end[i]; } return RubyFixnum.newFixnum(runtime, e);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyMatchData.java File path: /jruby-1.4.0/src/org/jruby/RubyMatchData.java
Method name: IRubyObject begin19(ThreadContext, IRubyObject) Method name: IRubyObject end19(ThreadContext, IRubyObject)
Number of AST nodes: 9 Number of AST nodes: 9
1
int i = backrefNumber(index);
1
int i = backrefNumber(index);
2
        Ruby runtime = context.getRuntime();
2
        Ruby runtime = context.getRuntime();
3
        int b = beginCommon(runtime, i);
3
        int e = endCommon(runtime, i);
4
        if (b < 0) return runtime.getNil();
4
        if (e < 0) return runtime.getNil();
5
        if (!str.singleByteOptimizable()) {
5
        if (!str.singleByteOptimizable()) {
6
            updateCharOffset();
6
            updateCharOffset();
7
            b = charOffsets.beg[i];
7
            e = charOffsets.end[i];
8
        }
8
        }
9
        return RubyFixnum.newFixnum(runtime, b);
9
        return RubyFixnum.newFixnum(runtime, e);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are declared in the same class
Number of node comparisons36
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    int i = backrefNumber(index);
    1
    int i = backrefNumber(index);
    2
    Ruby runtime = context.getRuntime();
    2
    Ruby runtime = context.getRuntime();
    3
    int b = beginCommon(runtime, i);
    3
    int b = beginCommon(runtime, i);
    3
    int e = endCommon(runtime, i);
    Differences
    Expression1Expression2Difference
    beVARIABLE_NAME_MISMATCH
    beginCommonendCommonMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression beginCommon(runtime,i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method beginCommon
    Expression endCommon(runtime,i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method endCommon
    3
    int e = endCommon(runtime, i);
    4
    if (b < 0)
    4
    if (b < 0)
    4
    if (e < 0)
    Differences
    Expression1Expression2Difference
    beVARIABLE_NAME_MISMATCH
    4
    if (e < 0)
    5
    return runtime.getNil();
    5
    return runtime.getNil();
    6
    if (!str.singleByteOptimizable())
    6
    if (!str.singleByteOptimizable())
    7
    updateCharOffset();
    7
    updateCharOffset();
    8
    b = charOffsets.beg[i];
    8
    b = charOffsets.beg[i];
    8
    e = charOffsets.end[i];
    Differences
    Expression1Expression2Difference
    beVARIABLE_NAME_MISMATCH
    begendVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression charOffsets.beg cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression charOffsets.end cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    e = charOffsets.end[i];
    9
    return RubyFixnum.newFixnum(runtime, b);
    9
    return RubyFixnum.newFixnum(runtime, b);
    9
    return RubyFixnum.newFixnum(runtime, e);
    Differences
    Expression1Expression2Difference
    beVARIABLE_NAME_MISMATCH
    9
    return RubyFixnum.newFixnum(runtime, e);
    Precondition Violations (4)
    Row Violation
    1Expression beginCommon(runtime,i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression endCommon(runtime,i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression charOffsets.beg cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression charOffsets.end cannot be parameterized, because it has dependencies to/from statements that will be extracted