for (int r = 0, i = 0; r < nrows; r++) {
int row_height = 0;
for (int c = 0; c < ncols; c++, i++) {
if (i < ncomponents) {
switch (which) {
case 0:
row_height = Math.max(row_height, parent.getComponent(i).getMinimumSize().height);
break;
case 1:
row_height = Math.max(row_height, parent.getComponent(i).getMaximumSize().height);
break;
default:
row_height = Math.max(row_height, parent.getComponent(i).getPreferredSize().height);
break;
}
} else {
break;
}
}
h += row_height;
}
for (int r = 0, i = 0; r < nrows; r++) {
int row_height = 0;
for (int c = 0; c < ncols; c++, i++) {
if (i < ncomponents) {
switch (which) {
case 0:
row_height = Math.max(row_height, parent.getComponent(i).getMinimumSize().height);
break;
case 1:
row_height = Math.max(row_height, parent.getComponent(i).getMaximumSize().height);
break;
default:
row_height = Math.max(row_height, parent.getComponent(i).getPreferredSize().height);
break;
}
} else {
break;
}
}
h += row_height;
}
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: 16
|
|
Number of AST nodes: 16
|
|
1 | for (int r = 0, i = 0; r < nrows; r++) {↵ | | 1 | for (int r = 0, i = 0; r < nrows; r++) {↵
|
2 | int row_height = 0;↵ | | 2 | int row_height = 0;↵
|
3 | for (int c = 0; c < ncols; c++, i++) {↵ | | 3 | for (int c = 0; c < ncols; c++, i++) {↵
|
4 | if (i < ncomponents) {↵ | | 4 | if (i < ncomponents) {↵
|
5 | switch (which) {↵ | | 5 | switch (which) {↵
|
6 | case 0:↵ | | 6 | case 0:↵
|
7 | row_height = Math.max(row_height, parent.getComponent(i).getMinimumSize().height);↵ | | 7 | row_height = Math.max(row_height, parent.getComponent(i).getMinimumSize().height);↵
|
8 | break;↵ | | 8 | break;↵
|
9 | case 1:↵ | | 9 | case 1:↵
|
10 | row_height = Math.max(row_height, parent.getComponent(i).getMaximumSize().height);↵ | | 10 | row_height = Math.max(row_height, parent.getComponent(i).getMaximumSize().height);↵
|
11 | break;↵ | | 11 | break;↵
|
12 | default:↵ | | 12 | default:↵
|
13 | row_height = Math.max(row_height, parent.getComponent(i).getPreferredSize().height);↵ | | 13 | row_height = Math.max(row_height, parent.getComponent(i).getPreferredSize().height);↵
|
14 | break;↵ | | 14 | break;↵
|
15 | }↵ | | 15 | }↵
|
16 | } else {↵ | | 16 | } else {↵
|
17 | break;↵ | | 17 | break;↵
|
18 | }↵ | | 18 | }↵
|
19 | }↵ | | 19 | }↵
|
20 | h += row_height;↵ | | 20 | h += row_height;↵
|
21 | } | | 21 | }
|
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 | 72 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 16 |
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) | 5.3 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
6 | for (int r = 0, i = 0; r < nrows; r++) | | 6 | for (int r = 0, i = 0; r < nrows; r++) |
7 | | | 7 | |
8 | for (int c = 0; c < ncols; c++, i++) | | 8 | for (int c = 0; c < ncols; c++, i++) |
9 | | | 9 | |
10 | | | 10 | |
11 | | | 11 | |
12 | row_height = Math.max(row_height, parent.getComponent(i).getMinimumSize().height); | | 12 | row_height = Math.max(row_height, parent.getComponent(i).getMinimumSize().height); |
13 | | | 13 | |
14 | | | 14 | |
15 | row_height = Math.max(row_height, parent.getComponent(i).getMaximumSize().height); | | 15 | row_height = Math.max(row_height, parent.getComponent(i).getMaximumSize().height); |
16 | | | 16 | |
17 | | | 17 | |
18 | row_height = Math.max(row_height, parent.getComponent(i).getPreferredSize().height); | | 18 | row_height = Math.max(row_height, parent.getComponent(i).getPreferredSize().height); |
19 | | | 19 | |
| | | | |
20 | | | 20 | |
21 | | | 21 | |
Precondition Violations (0)
Row |
Violation |