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;
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: 16 Number of AST nodes: 16
1
int col_width = 0;
1
int col_width = 0;
2
				for (int r = 0; r < nrows; r++) {
2
				for (int r = 0; r < nrows; r++) {
3
					int i = r * ncols + c;
3
					int i = r * ncols + c;
4
					if (i < ncomponents) {
4
					if (i < ncomponents) {
5
						switch (which) {
5
						switch (which) {
6
							case 0:
6
							case 0:
7
								col_width = Math.max(col_width, parent.getComponent(i).getMinimumSize().width);
7
								col_width = Math.max(col_width, parent.getComponent(i).getMinimumSize().width);
8
								break;
8
								break;
9
							case 1:
9
							case 1:
10
								col_width = Math.max(col_width, parent.getComponent(i).getMaximumSize().width);
10
								col_width = Math.max(col_width, parent.getComponent(i).getMaximumSize().width);
11
								break;
11
								break;
12
							default:
12
							default:
13
								col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width);
13
								col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width);
14
								break;
14
								break;
15
						}
15
						}
16
					} else {
16
					} else {
17
						break;
17
						break;
18
					}
18
					}
19
				}
19
				}
20
				w += col_width;
20
				w += col_width;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are in different classes
Number of node comparisons70
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements16
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)5.1
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    23
    int col_width = 0;
    23
    int col_width = 0;
    24
    for (int r = 0; r < nrows; r++)
    24
    for (int r = 0; r < nrows; r++)
    25
    int i = r * ncols + c;
    25
    int i = r * ncols + c;
    26
    if (i < ncomponents)
    26
    if (i < ncomponents)
    27
    switch (which)
    27
    switch (which)
    28
    case 0:
    28
    case 0:
    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
    break;
    30
    break;
    31
    case 1:
    31
    case 1:
    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
    break;
    33
    break;
    34
    default:
    34
    default:
    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
    break;
    36
    break;
    else
    else
    37
    break;
    37
    break;
    38
    w += col_width;
    38
    w += col_width;
    Precondition Violations (0)
    Row Violation