Ruby runtime = context.getRuntime(); if (value.realSize == 0) { modifyCheck(); return runtime.getNil(); } Encoding enc = value.encoding; int s = value.begin; int end = s + value.realSize; byte[]bytes = value.bytes; final IRubyObject result; if (singleByteOptimizable(enc)) { result = singleByteLStrip(runtime, enc, bytes, s, end); } else { result = multiByteLStrip(runtime, enc, bytes, s, end); } keepCodeRange(); return result;
Ruby runtime = context.getRuntime(); if (value.realSize == 0) { modifyCheck(); return runtime.getNil(); } Encoding enc = value.encoding; int s = value.begin; int end = s + value.realSize; byte[]bytes = value.bytes; final IRubyObject result; if (singleByteOptimizable(enc)) { result = singleByteStrip(runtime, enc, bytes, s, end); } else { result = multiByteStrip(runtime, enc, bytes, s, end); } keepCodeRange(); return result;
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 lstrip_bang19(ThreadContext) Method name: IRubyObject strip_bang19(ThreadContext)
Number of AST nodes: 14 Number of AST nodes: 14
1
Ruby runtime = context.getRuntime();
1
Ruby runtime = context.getRuntime();
2
        if (value.realSize == 0) {
2
        if (value.realSize == 0) {
3
            modifyCheck();
3
            modifyCheck();
4
            return runtime.getNil();
4
            return runtime.getNil();
5
        }
5
        }
6
        Encoding enc = value.encoding;
6
        Encoding enc = value.encoding;
7
        int s = value.begin;
7
        int s = value.begin;
8
        int end = s + value.realSize;
8
        int end = s + value.realSize;
9
        byte[]bytes = value.bytes;
9
        byte[]bytes = value.bytes;
10
        final IRubyObject result;
10
        final IRubyObject result;
11
        if (singleByteOptimizable(enc)) {
11
        if (singleByteOptimizable(enc)) {
12
            result = singleByteLStrip(runtime, enc, bytes, s, end);
12
            result = singleByteStrip(runtime, enc, bytes, s, end);
13
        } else {
13
        } else {
14
            result = multiByteLStrip(runtime, enc, bytes, s, end);
14
            result = multiByteStrip(runtime, enc, bytes, s, end);
15
        }
15
        }
16
        keepCodeRange();
16
        keepCodeRange();
17
        return result;
17
        return result;
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.4
Clones locationClones are declared in the same class
Number of node comparisons92
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)7.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Ruby runtime = context.getRuntime();
    1
    Ruby runtime = context.getRuntime();
    2
    if (value.realSize == 0)
    2
    if (value.realSize == 0)
    3
    modifyCheck();
    3
    modifyCheck();
    4
    return runtime.getNil();
    4
    return runtime.getNil();
    5
    Encoding enc = value.encoding;
    5
    Encoding enc = value.encoding;
    6
    int s = value.begin;
    6
    int s = value.begin;
    7
    int end = s + value.realSize;
    7
    int end = s + value.realSize;
    8
    byte[] bytes = value.bytes;
    8
    byte[] bytes = value.bytes;
    9
    final IRubyObject result;
    9
    final IRubyObject result;
    10
    if (singleByteOptimizable(enc))
    10
    if (singleByteOptimizable(enc))
    11
    result = singleByteLStrip(runtime, enc, bytes, s, end);
    11
    result = singleByteLStrip(runtime, enc, bytes, s, end);
    11
    result = singleByteStrip(runtime, enc, bytes, s, end);
    Differences
    Expression1Expression2Difference
    singleByteLStripsingleByteStripMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression singleByteLStrip(runtime,enc,bytes,s,end) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method singleByteLStrip
    Expression singleByteStrip(runtime,enc,bytes,s,end) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method singleByteStrip
    11
    result = singleByteStrip(runtime, enc, bytes, s, end);
    else
    else
    12
    result = multiByteLStrip(runtime, enc, bytes, s, end);
    12
    result = multiByteLStrip(runtime, enc, bytes, s, end);
    12
    result = multiByteStrip(runtime, enc, bytes, s, end);
    Differences
    Expression1Expression2Difference
    multiByteLStripmultiByteStripMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression multiByteLStrip(runtime,enc,bytes,s,end) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method multiByteLStrip
    Expression multiByteStrip(runtime,enc,bytes,s,end) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method multiByteStrip
    12
    result = multiByteStrip(runtime, enc, bytes, s, end);
    13
    keepCodeRange();
    13
    keepCodeRange();
    14
    return result;
    14
    return result;
    Precondition Violations (4)
    Row Violation
    1Expression singleByteLStrip(runtime,enc,bytes,s,end) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression singleByteStrip(runtime,enc,bytes,s,end) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression multiByteLStrip(runtime,enc,bytes,s,end) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression multiByteStrip(runtime,enc,bytes,s,end) cannot be parameterized, because it has dependencies to/from statements that will be extracted