Ruby runtime = context.getRuntime();
IRubyObject i = from;
RubyFixnum one = RubyFixnum.one(runtime);
while (true) {
if (i.callMethod(context, "<", to).isTrue()) {
break;
}
block.yield(context, i);
i = i.callMethod(context, "-", one);
}
Ruby runtime = context.getRuntime();
IRubyObject i = from;
RubyFixnum one = RubyFixnum.one(runtime);
while (true) {
if (i.callMethod(context, ">", to).isTrue()) {
break;
}
block.yield(context, i);
i = i.callMethod(context, "+", one);
}
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyInteger.java
|
|
File path: /jruby-1.4.0/src/org/jruby/RubyInteger.java
|
Method name: void duckDownto(ThreadContext, IRubyObject, IRubyObject, Block)
|
|
Method name: void duckUpto(ThreadContext, IRubyObject, IRubyObject, Block)
|
Number of AST nodes: 8
|
|
Number of AST nodes: 8
|
|
1 | Ruby runtime = context.getRuntime();↵ | | 1 | Ruby runtime = context.getRuntime();↵
|
2 | IRubyObject i = from;↵ | | 2 | IRubyObject i = from;↵
|
3 | RubyFixnum one = RubyFixnum.one(runtime);↵ | | 3 | RubyFixnum one = RubyFixnum.one(runtime);↵
|
4 | while (true) {↵ | | 4 | while (true) {↵
|
5 | if (i.callMethod(context, "<", to).isTrue()) {↵ | | 5 | if (i.callMethod(context, ">", to).isTrue()) {↵
|
6 | break;↵ | | 6 | break;↵
|
7 | }↵ | | 7 | }↵
|
8 | block.yield(context, i);↵ | | 8 | block.yield(context, i);↵
|
9 | i = i.callMethod(context, "-", one);↵ | | 9 | i = i.callMethod(context, "+", one);↵
|
10 | } | | 10 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 22 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 8 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 2.4 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | Ruby runtime = context.getRuntime(); | | 1 | Ruby runtime = context.getRuntime(); |
2 | IRubyObject i = from; | | 2 | IRubyObject i = from; |
3 | RubyFixnum one = RubyFixnum.one(runtime); | | 3 | RubyFixnum one = RubyFixnum.one(runtime); |
4 | while (true) | | 4 | while (true) |
5 | if (i.callMethod(context, "<", to).isTrue()) | | 5 | if (i.callMethod(context, ">", to).isTrue()) |
6 | | | 6 | |
7 | | | 7 | |
8 | i = i.callMethod(context, "-", one); | | 8 | i = i.callMethod(context, "+", one); |
Precondition Violations (0)
Row |
Violation |