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; } }
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; }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/installer/VariableGridLayout.java File path: /jEdit-4.2/src/installer/VariableGridLayout.java
Method name: Dimension getLayoutSize(Container, int) Method name: Dimension getLayoutSize(Container, int)
Number of AST nodes: 13 Number of AST nodes: 13
1
for (int c = 0; c < ncols; c++, i++) {
1
int i = r * ncols + c;
2
					if (i < ncomponents) {
2
					if (i < ncomponents) {
3
						switch (which) {
3
						switch (which) {
4
							case 0:
4
							case 0:
5
								row_height = Math.max(row_height, parent.getComponent(i).getMinimumSize().height);
5
								col_width = Math.max(col_width, parent.getComponent(i).getMinimumSize().width);
6
								break;
6
								break;
7
							case 1:
7
							case 1:
8
								row_height = Math.max(row_height, parent.getComponent(i).getMaximumSize().height);
8
								col_width = Math.max(col_width, parent.getComponent(i).getMaximumSize().width);
9
								break;
9
								break;
10
							default:
10
							default:
11
								row_height = Math.max(row_height, parent.getComponent(i).getPreferredSize().height);
11
								col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width);
12
								break;
12
								break;
13
						}
13
						}
14
					} else {
14
					} else {
15
						break;
15
						break;
16
					}
16
					}
17
				}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are in the same method
Number of node comparisons63
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)5.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                    
    25
    int i = r * ncols + c;
    Preondition Violations
    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
    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);
    12
    row_height = Math.max(row_height, parent.getComponent(i).getMinimumSize().height);
    29
    col_width = Math.max(col_width, parent.getComponent(i).getMinimumSize().width);
    Differences
    Expression1Expression2Difference
    row_heightcol_widthVARIABLE_NAME_MISMATCH
    row_heightcol_widthVARIABLE_NAME_MISMATCH
    heightwidthVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression parent.getComponent(i).getMinimumSize().height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression parent.getComponent(i).getMinimumSize().width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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);
    15
    row_height = Math.max(row_height, parent.getComponent(i).getMaximumSize().height);
    32
    col_width = Math.max(col_width, parent.getComponent(i).getMaximumSize().width);
    Differences
    Expression1Expression2Difference
    row_heightcol_widthVARIABLE_NAME_MISMATCH
    row_heightcol_widthVARIABLE_NAME_MISMATCH
    heightwidthVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression parent.getComponent(i).getMaximumSize().height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression parent.getComponent(i).getMaximumSize().width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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);
    18
    row_height = Math.max(row_height, parent.getComponent(i).getPreferredSize().height);
    35
    col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width);
    Differences
    Expression1Expression2Difference
    row_heightcol_widthVARIABLE_NAME_MISMATCH
    row_heightcol_widthVARIABLE_NAME_MISMATCH
    heightwidthVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression parent.getComponent(i).getPreferredSize().height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression parent.getComponent(i).getPreferredSize().width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    35
    col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width);
    19
    break;
    36
    break;
    else
    else
    20
    break;
    20
    break;
    37
    break;
    Preondition Violations
    Statement break; without innermost loop
    Statement break; without innermost loop
    37
    break;
    Precondition Violations (9)
    Row Violation
    1Unmatched 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
    2Expression parent.getComponent(i).getMinimumSize().height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression parent.getComponent(i).getMinimumSize().width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression parent.getComponent(i).getMaximumSize().height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression parent.getComponent(i).getMaximumSize().width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression parent.getComponent(i).getPreferredSize().height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression parent.getComponent(i).getPreferredSize().width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Statement break; without innermost loop
    9Statement break; without innermost loop