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);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)1.2
Clones locationClones are declared in the same class
Number of node comparisons7
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.5
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    1
    if (parts < 1)
    1
    if (parts < 1)
    2
    return null;
    2
    return null;
    Precondition Violations (0)
    Row Violation