File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/optional/image/Scale.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/optional/image/Scale.java | |||
Method name: float getWidth()
|
Method name: float getHeight()
|
|||
Number of AST nodes: 8 | Number of AST nodes: 7 | |||
1 | float width = 0.0F;↵ | |||
2 | int percIndex = widthStr.indexOf('%');↵ | 1 | int percIndex = heightStr.indexOf('%');↵ | |
3 | if (percIndex > 0) {↵ | 2 | if (percIndex > 0) {↵ | |
4 | width = Float.parseFloat(widthStr.substring(0, percIndex));↵ | 3 | float height = Float.parseFloat(heightStr.substring(0, percIndex));↵ | |
5 | xPercent = true;↵ | 4 | yPercent = true;↵ | |
6 | return width / HUNDRED;↵ | 5 | return height / HUNDRED;↵ | |
7 | } else {↵ | 6 | } else {↵ | |
8 | xPercent = false;↵ | 7 | yPercent = false;↵ | |
9 | return Float.parseFloat(widthStr);↵ | 8 | return Float.parseFloat(heightStr);↵ | |
10 | } | 9 |
| |
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.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 38 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.3 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | float width = 0.0F; | | ||||||||||||||
2 | int percIndex = widthStr.indexOf('%'); |
| 1 | int percIndex = heightStr.indexOf('%'); | ||||||||||||
3 | if (percIndex > 0) | 2 | if (percIndex > 0) | |||||||||||||
|
| 3 | float height = Float.parseFloat(heightStr.substring(0, percIndex)); | |||||||||||||
4 | width = Float.parseFloat(widthStr.substring(0, percIndex)); |
| | |||||||||||||
5 | xPercent = true; |
| 4 | yPercent = true; | ||||||||||||
6 | return width / HUNDRED; |
| 5 | return height / HUNDRED; | ||||||||||||
else | else | |||||||||||||||
7 | xPercent = false; |
| 6 | yPercent = false; | ||||||||||||
8 | return Float.parseFloat(widthStr); |
| 7 | return Float.parseFloat(heightStr); |
Row | Violation |
---|---|
1 | Unmatched statement float height=Float.parseFloat(heightStr.substring(0,percIndex)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement width=Float.parseFloat(widthStr.substring(0,percIndex)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Expression xPercent is a field being modified, and thus it cannot be parameterized |
4 | Expression yPercent is a field being modified, and thus it cannot be parameterized |
5 | Expression xPercent is a field being modified, and thus it cannot be parameterized |
6 | Expression yPercent is a field being modified, and thus it cannot be parameterized |