switch (args.length) {
case 1: return newInstanceBang(context, recv, args[0]);
case 2: return newInstanceBang(context, recv, args[0], args[1]);
}
Arity.raiseArgumentError(context.getRuntime(), args.length, 1, 1);
return null;
switch (args.length) {
case 1: return convert(context, clazz, args[0]);
case 2: return convert(context, clazz, args[0], args[1]);
}
Arity.raiseArgumentError(context.getRuntime(), args.length, 1, 1);
return null;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyComplex.java
|
|
File path: /jruby-1.4.0/src/org/jruby/RubyRational.java
|
Method name: IRubyObject newInstanceBang(ThreadContext, IRubyObject, IRubyObject[])
|
|
Method name: IRubyObject convert(ThreadContext, IRubyObject, IRubyObject[])
|
Number of AST nodes: 7
|
|
Number of AST nodes: 7
|
|
1 | switch (args.length) {↵ | | 1 | switch (args.length) {↵
|
2 | case 1: return newInstanceBang(context, recv, args[0]);↵ | | 2 | case 1: return convert(context, clazz, args[0]); ↵
|
3 | case 2: return newInstanceBang(context, recv, args[0], args[1]);↵ | | 3 | case 2: return convert(context, clazz, args[0], args[1]);↵
|
4 | }↵ | | 4 | }↵
|
5 | Arity.raiseArgumentError(context.getRuntime(), args.length, 1, 1);↵ | | 5 | Arity.raiseArgumentError(context.getRuntime(), args.length, 1, 1);↵
|
6 | return null; | | 6 | return null;
|
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.1 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 17 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 7 |
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) | 4271.5 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | switch (args.length) | | 1 | switch (args.length) |
2 | | | 2 | |
3 | return newInstanceBang(context, recv, args[0]); | | 3 | return convert(context, clazz, args[0]); |
4 | | | 4 | |
5 | return newInstanceBang(context, recv, args[0], args[1]); | | 5 | return convert(context, clazz, args[0], args[1]); |
6 | Arity.raiseArgumentError(context.getRuntime(), args.length, 1, 1); | | 6 | Arity.raiseArgumentError(context.getRuntime(), args.length, 1, 1); |
7 | return null; | | 7 | return null; |
Precondition Violations (0)
Row |
Violation |