if (parts < 1 )
return null;
int count = 0;
int index = -1;
while( ((index = value.indexOf('.', index + 1)) != -1)
&& (++count < parts) )
{ ; }
return (index == -1) ? value : value.substring(0, index);
if (parts < 1)
return null;
int count = 0;
int index = value.length() + 1;
while ( ((index = value.lastIndexOf('.', index - 1)) != -1)
&& (++count < parts) );
return (index == -1) ? value : value.substring(index + 1);
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/bsh/Name.java
|
|
File path: /jEdit-4.2/src/bsh/Name.java
|
Method name: String prefix(String, int)
|
|
Method name: String suffix(String, int)
|
Number of AST nodes: 7
|
|
Number of AST nodes: 7
|
|
1 | if (parts < 1 )↵ | | 1 | if (parts < 1)↵
|
2 | return null;↵ | | 2 | return null;↵
|
|
3 | int count = 0;↵ | | 3 | int count = 0;↵
|
4 | int index = -1;↵ | | 4 | int index = value.length() + 1;↵
|
|
5 | while( ((index = value.indexOf('.', index + 1)) != -1) ↵ | | 5 | while ( ((index = value.lastIndexOf('.', index - 1)) != -1) ↵
|
6 | && (++count < parts) )↵ | | 6 | && (++count < parts) )↵
|
7 | { ; }↵ | | 7 | ;↵
|
|
8 | return (index == -1) ? value : value.substring(0, index); | | 8 | return (index == -1) ? value : value.substring(index + 1);
|
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) | 1.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 7 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 2 |
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) | 0.5 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (parts < 1) | | 1 | if (parts < 1) |
2 | | | 2 | |
Precondition Violations (0)
Row |
Violation |