File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java | |||
Method name: String createOutputFileName(File, String, String)
|
Method name: String createOutputFileName(File, String, boolean)
|
|||
Number of AST nodes: 11 | Number of AST nodes: 10 | |||
1 | if ((optionalOutputFile == null) || optionalOutputFile.equals("")) {↵ | |||
2 | int filePos = jjtreeFile.lastIndexOf("/");↵ | 1 | int filePos = javaccFile.lastIndexOf("/");↵ | |
3 | if (filePos >= 0) {↵ | 2 | if (filePos >= 0) {↵ | |
4 | jjtreeFile = jjtreeFile.substring(filePos + 1);↵ | 3 | javaccFile = javaccFile.substring(filePos + 1);↵ | |
5 | }↵ | 4 | }↵ | |
6 | int suffixPos = jjtreeFile.lastIndexOf('.');↵ | 5 | int suffixPos = javaccFile.lastIndexOf('.');↵ | |
7 | if (suffixPos == -1) {↵ | 6 | if (suffixPos == -1) {↵ | |
8 | optionalOutputFile = jjtreeFile + DEFAULT_SUFFIX;↵ | 7 | optionalOutputFile = javaccFile + suffix;↵ | |
9 | } else {↵ | 8 | } else {↵ | |
10 | String currentSuffix = jjtreeFile.substring(suffixPos);↵ | 9 | String currentSuffix = javaccFile.substring(suffixPos);↵ | |
11 | if (currentSuffix.equals(DEFAULT_SUFFIX)) {↵ | 10 | if (currentSuffix.equals(suffix)) {↵ | |
12 | optionalOutputFile = jjtreeFile + DEFAULT_SUFFIX;↵ | 11 | optionalOutputFile = javaccFile + suffix;↵ | |
13 | } else {↵ | 12 | } else {↵ | |
14 | optionalOutputFile = jjtreeFile.substring(0, suffixPos)↵ | 13 | optionalOutputFile = javaccFile.substring(0, suffixPos)↵ | |
15 | + DEFAULT_SUFFIX;↵ | 14 | + suffix;↵ | |
16 | }↵ | 15 | }↵ | |
17 | }↵ | 16 |
| |
18 | } | |||
See real code fragment | See real code fragment |
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.7 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 34 |
Number of mapped statements | 10 |
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) | 3.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | int filePos = jjtreeFile.lastIndexOf("/"); |
| 6 | int filePos = javaccFile.lastIndexOf("/"); | |||||||||||||
5 | if (filePos >= 0) | 7 | if (filePos >= 0) | ||||||||||||||
6 | jjtreeFile = jjtreeFile.substring(filePos + 1); |
| 8 | javaccFile = javaccFile.substring(filePos + 1); | |||||||||||||
7 | int suffixPos = jjtreeFile.lastIndexOf('.'); |
| 9 | int suffixPos = javaccFile.lastIndexOf('.'); | |||||||||||||
8 | if (suffixPos == -1) | 10 | if (suffixPos == -1) | ||||||||||||||
9 | optionalOutputFile = jjtreeFile + DEFAULT_SUFFIX; |
| 11 | optionalOutputFile = javaccFile + suffix; | |||||||||||||
else | else | ||||||||||||||||
10 | String currentSuffix = jjtreeFile.substring(suffixPos); |
| 12 | String currentSuffix = javaccFile.substring(suffixPos); | |||||||||||||
11 | if (currentSuffix.equals(DEFAULT_SUFFIX)) |
| 13 | if (currentSuffix.equals(suffix)) | |||||||||||||
12 | optionalOutputFile = jjtreeFile + DEFAULT_SUFFIX; |
| 14 | optionalOutputFile = javaccFile + suffix; | |||||||||||||
else | else | ||||||||||||||||
13 | optionalOutputFile = jjtreeFile.substring(0, suffixPos) + DEFAULT_SUFFIX; |
| 15 | optionalOutputFile = javaccFile.substring(0, suffixPos) + suffix; |
Row | Violation |
---|