File path: /jruby-1.4.0/src/org/jruby/compiler/ASTCompiler.java | File path: /jruby-1.4.0/src/org/jruby/compiler/ASTCompiler.java | |||
Method name: FastSwitchType getHomogeneousSwitchType(List
|
Method name: FastSwitchType getHomogeneousSwitchType(List
|
|||
Number of AST nodes: 12 | Number of AST nodes: 12 | |||
1 | StrNode strNode = (StrNode)whenNode.getExpressionNodes();↵ | 1 | SymbolNode symbolNode = (SymbolNode)whenNode.getExpressionNodes();↵ | |
2 | if (strNode.getValue().length() == 1) {↵ | 2 | if (symbolNode.getName().length() == 1) {↵ | |
3 | if (foundType != null && foundType != FastSwitchType.SINGLE_CHAR_STRING) return null;↵ | 3 | if (foundType != null && foundType != FastSwitchType.SINGLE_CHAR_SYMBOL) return null;↵ | |
4 | if (foundType == null) foundType = FastSwitchType.SINGLE_CHAR_STRING;↵ | 4 | if (foundType == null) foundType = FastSwitchType.SINGLE_CHAR_SYMBOL;↵ | |
5 | continue;↵ | 5 | continue;↵ | |
6 | } else {↵ | 6 | } else {↵ | |
7 | if (foundType != null && foundType != FastSwitchType.STRING) return null;↵ | 7 | if (foundType != null && foundType != FastSwitchType.SYMBOL) return null;↵ | |
8 | if (foundType == null) foundType = FastSwitchType.STRING;↵ | 8 | if (foundType == null) foundType = FastSwitchType.SYMBOL;↵ | |
9 | continue;↵ | 9 | continue;↵ | |
10 | } | 10 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 2 |
Number of refactorable cases | 2 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 2.0 |
Clones location | Clones are in the same method |
Number of node comparisons | 36 |
Number of mapped statements | 4 |
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) | 1.5 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
31 | if (foundType != null && foundType != FastSwitchType.SINGLE_CHAR_STRING) |
| 44 | if (foundType != null && foundType != FastSwitchType.SINGLE_CHAR_SYMBOL) | ||||||||||
32 | return null; | 45 | return null; | |||||||||||
33 | if (foundType == null) | 46 | if (foundType == null) | |||||||||||
34 | foundType = FastSwitchType.SINGLE_CHAR_STRING; |
| 47 | foundType = FastSwitchType.SINGLE_CHAR_SYMBOL; |
Row | Violation |
---|
Number of mapped statements | 4 |
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) | 1.2 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
36 | if (foundType != null && foundType != FastSwitchType.STRING) |
| 44 | if (foundType != null && foundType != FastSwitchType.SINGLE_CHAR_SYMBOL) | ||||||||||
37 | return null; | 45 | return null; | |||||||||||
38 | if (foundType == null) | 46 | if (foundType == null) | |||||||||||
39 | foundType = FastSwitchType.STRING; |
| 47 | foundType = FastSwitchType.SINGLE_CHAR_SYMBOL; |
Row | Violation |
---|