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 matchPatternStart(String, String, boolean)
|
Method name: boolean matchPath(String, String, boolean)
|
|||
Number of AST nodes: 14 | Number of AST nodes: 16 | |||
1 | String[] patDirs = tokenizePathAsArray(pattern);↵ | 1 | String[] patDirs = tokenizePathAsArray(pattern);↵ | |
2 | String[] strDirs = tokenizePathAsArray(str);↵ | 2 | String[] strDirs = tokenizePathAsArray(str);↵ | |
3 | int patIdxStart = 0;↵ | 3 | int patIdxStart = 0;↵ | |
4 | int patIdxEnd = patDirs.length - 1;↵ | 4 | int patIdxEnd = patDirs.length - 1;↵ | |
5 | int strIdxStart = 0;↵ | 5 | int strIdxStart = 0;↵ | |
6 | int strIdxEnd = strDirs.length - 1;↵ | 6 | int strIdxEnd = strDirs.length - 1;↵ | |
7 | // up to first '**'↵ | 7 | // up to first '**'↵ | |
8 | while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {↵ | 8 | while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {↵ | |
9 | String patDir = patDirs[patIdxStart];↵ | 9 | String patDir = patDirs[patIdxStart];↵ | |
10 | if (patDir.equals("**")) {↵ | 10 | if (patDir.equals("**")) {↵ | |
11 | break;↵ | 11 | break;↵ | |
12 | }↵ | 12 | }↵ | |
13 | if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) {↵ | 13 | if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) {↵ | |
14 | patDirs = null;↵ | |||
15 | strDirs = null;↵ | |||
14 | return false;↵ | 16 | return false;↵ | |
15 | }↵ | 17 | }↵ | |
16 | patIdxStart++;↵ | 18 | patIdxStart++;↵ | |
17 | strIdxStart++;↵ | 19 | strIdxStart++;↵ | |
18 | } | 20 |
| |
See real code fragment | See real code fragment |
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.6 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 73 |
Number of mapped statements | 14 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 3.3 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||
---|---|---|---|---|---|---|---|---|---|---|
3 | String[] patDirs = tokenizePathAsArray(pattern); | 1 | String[] patDirs = tokenizePathAsArray(pattern); | |||||||
4 | String[] strDirs = tokenizePathAsArray(str); | 2 | String[] strDirs = tokenizePathAsArray(str); | |||||||
5 | int patIdxStart = 0; | 3 | int patIdxStart = 0; | |||||||
6 | int patIdxEnd = patDirs.length - 1; | 4 | int patIdxEnd = patDirs.length - 1; | |||||||
7 | int strIdxStart = 0; | 5 | int strIdxStart = 0; | |||||||
8 | int strIdxEnd = strDirs.length - 1; | 6 | int strIdxEnd = strDirs.length - 1; | |||||||
9 | while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) | 7 | while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) | |||||||
10 | String patDir = patDirs[patIdxStart]; | 8 | String patDir = patDirs[patIdxStart]; | |||||||
11 | if (patDir.equals("**")) | 9 | if (patDir.equals("**")) | |||||||
12 | break; | 10 | break; | |||||||
13 | if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) | 11 | if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) | |||||||
|
| 12 | patDirs = null; | |||||||
|
| 13 | strDirs = null; | |||||||
14 | return false; |
| 14 | return false; | ||||||
15 | patIdxStart++; | 15 | patIdxStart++; | |||||||
16 | strIdxStart++; | 16 | strIdxStart++; |
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, strIdxEnd, patIdxStart, patIdxEnd , while Clone fragment #2 returns variables patDirs, strDirs, strIdxStart, strIdxEnd, patIdxStart, patIdxEnd |
4 | Conditional return false; |
5 | Conditional return false; |