for (int c = 0; c < ncols; c++) {
int col_width = 0;
for (int r = 0; r < nrows; r++) {
int i = r * ncols + c;
if (i < ncomponents) {
switch (which) {
case 0:
col_width = Math.max(col_width, parent.getComponent(i).getMinimumSize().width);
break;
case 1:
col_width = Math.max(col_width, parent.getComponent(i).getMaximumSize().width);
break;
default:
col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width);
break;
}
} else {
break;
}
}
w += col_width;
}
for (int c = 0; c < ncols; c++) {
int col_width = 0;
for (int r = 0; r < nrows; r++) {
int i = r * ncols + c;
if (i < ncomponents) {
switch (which) {
case 0:
col_width = Math.max(col_width, parent.getComponent(i).getMinimumSize().width);
break;
case 1:
col_width = Math.max(col_width, parent.getComponent(i).getMaximumSize().width);
break;
default:
col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width);
break;
}
} else {
break;
}
}
w += col_width;
}
Clone fragments detected by clone detection tool
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: 17
|
|
Number of AST nodes: 17
|
|
1 | for (int c = 0; c < ncols; c++) {↵ | | 1 | for (int c = 0; c < ncols; c++) {↵
|
2 | int col_width = 0;↵ | | 2 | int col_width = 0;↵
|
3 | for (int r = 0; r < nrows; r++) {↵ | | 3 | for (int r = 0; r < nrows; r++) {↵
|
4 | int i = r * ncols + c;↵ | | 4 | int i = r * ncols + c;↵
|
5 | if (i < ncomponents) {↵ | | 5 | if (i < ncomponents) {↵
|
6 | switch (which) {↵ | | 6 | switch (which) {↵
|
7 | case 0:↵ | | 7 | case 0:↵
|
8 | col_width = Math.max(col_width, parent.getComponent(i).getMinimumSize().width);↵ | | 8 | col_width = Math.max(col_width, parent.getComponent(i).getMinimumSize().width);↵
|
9 | break;↵ | | 9 | break;↵
|
10 | case 1:↵ | | 10 | case 1:↵
|
11 | col_width = Math.max(col_width, parent.getComponent(i).getMaximumSize().width);↵ | | 11 | col_width = Math.max(col_width, parent.getComponent(i).getMaximumSize().width);↵
|
12 | break;↵ | | 12 | break;↵
|
13 | default:↵ | | 13 | default:↵
|
14 | col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width);↵ | | 14 | col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width);↵
|
15 | break;↵ | | 15 | break;↵
|
16 | }↵ | | 16 | }↵
|
17 | } else {↵ | | 17 | } else {↵
|
18 | break;↵ | | 18 | break;↵
|
19 | }↵ | | 19 | }↵
|
20 | }↵ | | 20 | }↵
|
21 | w += col_width;↵ | | 21 | w += col_width;↵
|
22 | } | | 22 | }
|
See real code fragment |
|
See real code fragment |
Summary
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.5 |
Clones location | Clones are in different classes |
Number of node comparisons | 75 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 17 |
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) | 6.2 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
22 | for (int c = 0; c < ncols; c++) | | 22 | for (int c = 0; c < ncols; c++) |
23 | | | 23 | |
24 | for (int r = 0; r < nrows; r++) | | 24 | for (int r = 0; r < nrows; r++) |
25 | | | 25 | |
26 | | | 26 | |
27 | | | 27 | |
28 | | | 28 | |
29 | col_width = Math.max(col_width, parent.getComponent(i).getMinimumSize().width); | | 29 | col_width = Math.max(col_width, parent.getComponent(i).getMinimumSize().width); |
30 | | | 30 | |
31 | | | 31 | |
32 | col_width = Math.max(col_width, parent.getComponent(i).getMaximumSize().width); | | 32 | col_width = Math.max(col_width, parent.getComponent(i).getMaximumSize().width); |
33 | | | 33 | |
34 | | | 34 | |
35 | col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width); | | 35 | col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width); |
36 | | | 36 | |
| | | | |
37 | | | 37 | |
38 | | | 38 | |
Precondition Violations (0)
Row |
Violation |