while (i-- > 0) { if (i > realLength) { i = realLength; continue; } if (equalInternal(context, values[begin + i], obj)) return runtime.newFixnum(i); }
while (i-- > 0) { if (i > realLength) { i = realLength; continue; } if (block.yield(context, values[begin + i]).isTrue()) return runtime.newFixnum(i); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyArray.java File path: /jruby-1.4.0/src/org/jruby/RubyArray.java
Method name: IRubyObject rindex(ThreadContext, IRubyObject) Method name: IRubyObject rindex(ThreadContext, Block)
Number of AST nodes: 6 Number of AST nodes: 6
1
while (i-- > 0) {
1
while (i-- > 0) {
2
            if (i > realLength) {
2
            if (i > realLength) {
3
                i = realLength;
3
                i = realLength;
4
                continue;
4
                continue;
5
            }
5
            }
6
            if (equalInternal(context, values[begin + i], obj)) return runtime.newFixnum(i);
6
            if (block.yield(context, values[begin + i]).isTrue()) return runtime.newFixnum(i);
7
        }
7
        }
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 comparisons21
  1. {Non-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.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    while (i-- > 0)
    5
    while (i-- > 0)
    4
    if (i > realLength)
    6
    if (i > realLength)
    5
    i = realLength;
    7
    i = realLength;
    6
    continue;
    8
    continue;
    7
    if (equalInternal(context, values[begin + i], obj))
    7
    if (equalInternal(context, values[begin + i], obj))
    9
    if (block.yield(context, values[begin + i]).isTrue())
    Differences
    Expression1Expression2Difference
    equalInternalisTrueMETHOD_INVOCATION_NAME_MISMATCH
    equalInternal(context,values[begin + i],obj)block.yield(context,values[begin + i]).isTrue()ARGUMENT_NUMBER_MISMATCH
    block.yield(context,values[begin + i])MISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression equalInternal(context,values[begin + i],obj) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression block.yield(context,values[begin + i]).isTrue() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression equalInternal(context,values[begin + i],obj) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression block.yield(context,values[begin + i]).isTrue() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9
    if (block.yield(context, values[begin + i]).isTrue())
    8
    return runtime.newFixnum(i);
    10
    return runtime.newFixnum(i);
    Precondition Violations (4)
    Row Violation
    1Expression equalInternal(context,values[begin + i],obj) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression block.yield(context,values[begin + i]).isTrue() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression equalInternal(context,values[begin + i],obj) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression block.yield(context,values[begin + i]).isTrue() cannot be parameterized, because it has dependencies to/from statements that will be extracted