while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {
String patDir = patDirs[patIdxStart];
if (patDir.equals("**")) {
break;
}
if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) {
patDirs = null;
strDirs = null;
return false;
}
patIdxStart++;
strIdxStart++;
}
while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {
String patDir = patDirs[patIdxStart];
if (patDir.equals("**")) {
break;
}
if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) {
return false;
}
patIdxStart++;
strIdxStart++;
}
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/SelectorUtils.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/SelectorUtils.java
|
Method name: boolean matchPath(String, String, boolean)
|
|
Method name: boolean matchPatternStart(String, String, boolean)
|
Number of AST nodes: 10
|
|
Number of AST nodes: 8
|
|
1 | while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {↵ | | 1 | while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {↵
|
2 | String patDir = patDirs[patIdxStart];↵ | | 2 | String patDir = patDirs[patIdxStart];↵
|
3 | if (patDir.equals("**")) {↵ | | 3 | if (patDir.equals("**")) {↵
|
4 | break;↵ | | 4 | break;↵
|
5 | }↵ | | 5 | }↵
|
6 | if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) {↵ | | 6 | if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) {↵
|
7 | patDirs = null;↵ | | |
|
8 | strDirs = null;↵ | | |
|
9 | return false;↵ | | 7 | return false;↵
|
10 | }↵ | | 8 | }↵
|
11 | patIdxStart++;↵ | | 9 | patIdxStart++;↵
|
12 | strIdxStart++;↵ | | 10 | strIdxStart++;↵
|
13 | } | | 11 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 38 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 8 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.8 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
7 | while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) | | 9 | while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) |
8 | String patDir = patDirs[patIdxStart]; | | 10 | String patDir = patDirs[patIdxStart]; |
9 | | | 11 | |
10 | | | 12 | |
11 | if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) | | 13 | if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) |
12 | | | | |
13 | | | | |
14 | | | 14 | |
15 | | | 15 | |
16 | | | 16 | |
Precondition Violations (5)
Row |
Violation |
1 | Unmatched statement patDirs=null; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement strDirs=null; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Clone fragment #1 returns variables strIdxStart, patIdxStart , while Clone fragment #2 returns variables strIdxStart, patIdxStart |
4 | Conditional return false; |
5 | Conditional return false; |