String f = get_path(context, filename).getUnicodeValue();
if(f.startsWith("file:") && f.indexOf('!') != -1) {
f = f.substring(5, f.indexOf("!"));
}
return context.getRuntime().newFileStat(f, false).atime();
String f = get_path(context, filename).getUnicodeValue();
if(f.startsWith("file:") && f.indexOf('!') != -1) {
f = f.substring(5, f.indexOf("!"));
}
return context.getRuntime().newFileStat(f, false);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyFile.java
|
|
File path: /jruby-1.4.0/src/org/jruby/RubyFile.java
|
Method name: IRubyObject atime(ThreadContext, IRubyObject, IRubyObject)
|
|
Method name: IRubyObject stat(ThreadContext, IRubyObject, IRubyObject)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | String f = get_path(context, filename).getUnicodeValue();↵ | | 1 | String f = get_path(context, filename).getUnicodeValue();↵
|
2 | if(f.startsWith("file:") && f.indexOf('!') != -1) {↵ | | 2 | if(f.startsWith("file:") && f.indexOf('!') != -1) {↵
|
3 | f = f.substring(5, f.indexOf("!"));↵ | | 3 | f = f.substring(5, f.indexOf("!"));↵
|
4 | }↵ | | 4 | }↵
|
5 | return context.getRuntime().newFileStat(f, false).atime(); | | 5 | return context.getRuntime().newFileStat(f, false);
|
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 | 8 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | String f = get_path(context, filename).getUnicodeValue(); | | 1 | String f = get_path(context, filename).getUnicodeValue(); |
2 | if (f.startsWith("file:") && f.indexOf('!') != -1) | | 2 | if (f.startsWith("file:") && f.indexOf('!') != -1) |
3 | f = f.substring(5, f.indexOf("!")); | | 3 | f = f.substring(5, f.indexOf("!")); |
| | | 4 | return context.getRuntime().newFileStat(f, false); |
4 | return context.getRuntime().newFileStat(f, false).atime(); | | | |
Precondition Violations (0)
Row |
Violation |