File path: /jEdit-4.2/src/installer/VariableGridLayout.java | File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/VariableGridLayout.java | |||
Method name: Dimension getLayoutSize(Container, int)
|
Method name: Dimension getLayoutSize(Container, int)
|
|||
Number of AST nodes: 16 | Number of AST nodes: 17 | |||
1 | for (int r = 0, i = 0; r < nrows; r++) {↵ | 1 | for (int c = 0; c < ncols; c++) {↵ | |
2 | int row_height = 0;↵ | 2 | int col_width = 0;↵ | |
3 | for (int c = 0; c < ncols; c++, i++) {↵ | 3 | for (int r = 0; r < nrows; r++) {↵ | |
4 | int i = r * ncols + c;↵ | |||
4 | if (i < ncomponents) {↵ | 5 | if (i < ncomponents) {↵ | |
5 | switch (which) {↵ | 6 | switch (which) {↵ | |
6 | case 0:↵ | 7 | case 0:↵ | |
7 | row_height = Math.max(row_height, parent.getComponent(i).getMinimumSize().height);↵ | 8 | col_width = Math.max(col_width, parent.getComponent(i).getMinimumSize().width);↵ | |
8 | break;↵ | 9 | break;↵ | |
9 | case 1:↵ | 10 | case 1:↵ | |
10 | row_height = Math.max(row_height, parent.getComponent(i).getMaximumSize().height);↵ | 11 | col_width = Math.max(col_width, parent.getComponent(i).getMaximumSize().width);↵ | |
11 | break;↵ | 12 | break;↵ | |
12 | default:↵ | 13 | default:↵ | |
13 | row_height = Math.max(row_height, parent.getComponent(i).getPreferredSize().height);↵ | 14 | col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width);↵ | |
14 | break;↵ | 15 | break;↵ | |
15 | }↵ | 16 | }↵ | |
16 | } else {↵ | 17 | } else {↵ | |
17 | break;↵ | 18 | break;↵ | |
18 | }↵ | 19 | }↵ | |
19 | }↵ | 20 | }↵ | |
20 | h += row_height;↵ | 21 | w += col_width;↵ | |
21 | } | 22 |
| |
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.3 |
Clones location | Clones are in different classes |
Number of node comparisons | 63 |
Number of mapped statements | 12 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 6.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| 25 | int i = r * ncols + c; | |||||||||||||||||||
9 | if (i < ncomponents) | 26 | if (i < ncomponents) | |||||||||||||||||||
10 | switch (which) | 27 | switch (which) | |||||||||||||||||||
11 | case 0: | 28 | case 0: | |||||||||||||||||||
12 | row_height = Math.max(row_height, parent.getComponent(i).getMinimumSize().height); |
| 29 | col_width = Math.max(col_width, parent.getComponent(i).getMinimumSize().width); | ||||||||||||||||||
13 | break; | 30 | break; | |||||||||||||||||||
14 | case 1: | 31 | case 1: | |||||||||||||||||||
15 | row_height = Math.max(row_height, parent.getComponent(i).getMaximumSize().height); |
| 32 | col_width = Math.max(col_width, parent.getComponent(i).getMaximumSize().width); | ||||||||||||||||||
16 | break; | 33 | break; | |||||||||||||||||||
17 | default: | 34 | default: | |||||||||||||||||||
18 | row_height = Math.max(row_height, parent.getComponent(i).getPreferredSize().height); |
| 35 | col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width); | ||||||||||||||||||
19 | break; | 36 | break; | |||||||||||||||||||
else | else | |||||||||||||||||||||
20 | break; |
| 37 | break; |
Row | Violation |
---|---|
1 | Unmatched statement int i=r * ncols + c; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Expression parent.getComponent(i).getMinimumSize().height cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression parent.getComponent(i).getMinimumSize().width cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression parent.getComponent(i).getMaximumSize().height cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression parent.getComponent(i).getMaximumSize().width cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression parent.getComponent(i).getPreferredSize().height cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression parent.getComponent(i).getPreferredSize().width cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Statement break; without innermost loop |
9 | Statement break; without innermost loop |