while (p < end) { int cl = StringSupport.length(enc, bytes, p, end); if (cl > 1 || (bytes[p] & 0x80) != 0) { single = false; op -= cl; System.arraycopy(bytes, p, obytes, op, cl); p += cl; } else { obytes[--op] = bytes[p++]; } }
while (p < end) { int cl = StringSupport.length(enc, bytes, p, end); if (cl > 1 || (bytes[p] & 0x80) != 0) { single = false; op -= cl; System.arraycopy(bytes, p, obytes, op, cl); p += cl; } else { obytes[--op] = bytes[p++]; } }
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: RubyString reverse_bang19(ThreadContext) Method name: IRubyObject reverse19(ThreadContext)
Number of AST nodes: 8 Number of AST nodes: 8
1
while (p < end) {
1
while (p < end) {
2
                    int cl = StringSupport.length(enc, bytes, p, end);
2
                int cl = StringSupport.length(enc, bytes, p, end);
3
                    if (cl > 1 || (bytes[p] & 0x80) != 0) {
3
                if (cl > 1 || (bytes[p] & 0x80) != 0) {
4
                        single = false;
4
                    single = false;
5
                        op -= cl;
5
                    op -= cl;
6
                        System.arraycopy(bytes, p, obytes, op, cl);
6
                    System.arraycopy(bytes, p, obytes, op, cl);
7
                        p += cl;
7
                    p += cl;
8
                    } else {
8
                } else {
9
                        obytes[--op] = bytes[p++];
9
                    obytes[--op] = bytes[p++];
10
                    }
10
                
11
    
11
}
12
            }
12
            }
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)1.1
Clones locationClones are declared in the same class
Number of node comparisons44
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.5
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    16
    while (p < end)
    16
    while (p < end)
    17
    int cl = StringSupport.length(enc, bytes, p, end);
    17
    int cl = StringSupport.length(enc, bytes, p, end);
    18
    if (cl > 1 || (bytes[p] & 0x80) != 0)
    18
    if (cl > 1 || (bytes[p] & 0x80) != 0)
    19
    single = false;
    19
    single = false;
    20
    op -= cl;
    20
    op -= cl;
    21
    System.arraycopy(bytes, p, obytes, op, cl);
    21
    System.arraycopy(bytes, p, obytes, op, cl);
    22
    p += cl;
    22
    p += cl;
    else
    else
    23
    obytes[--op] = bytes[p++];
    23
    obytes[--op] = bytes[p++];
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables obytes, single , while Clone fragment #2 returns variables obytes, single