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; }
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; }
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: 12 Number of AST nodes: 12
1
if (i < ncomponents) {
1
if (i < ncomponents) {
2
						switch (which) {
2
						switch (which) {
3
							case 0:
3
							case 0:
4
								col_width = Math.max(col_width, parent.getComponent(i).getMinimumSize().width);
4
								row_height = Math.max(row_height, parent.getComponent(i).getMinimumSize().height);
5
								break;
5
								break;
6
							case 1:
6
							case 1:
7
								col_width = Math.max(col_width, parent.getComponent(i).getMaximumSize().width);
7
								row_height = Math.max(row_height, parent.getComponent(i).getMaximumSize().height);
8
								break;
8
								break;
9
							default:
9
							default:
10
								col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width);
10
								row_height = Math.max(row_height, parent.getComponent(i).getPreferredSize().height);
11
								break;
11
								break;
12
						}
12
						}
13
					} else {
13
					} else {
14
						break;
14
						break;
15
					}
15
					}
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.2
Clones locationClones are in different classes
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 fragment0
    Time elapsed for statement mapping (ms)5.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    26
    if (i < ncomponents)
    9
    if (i < ncomponents)
    27
    switch (which)
    10
    switch (which)
    28
    case 0:
    11
    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);
    12
    row_height = Math.max(row_height, parent.getComponent(i).getMinimumSize().height);
    Differences
    Expression1Expression2Difference
    col_widthrow_heightVARIABLE_NAME_MISMATCH
    col_widthrow_heightVARIABLE_NAME_MISMATCH
    widthheightVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression parent.getComponent(i).getMinimumSize().width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression parent.getComponent(i).getMinimumSize().height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    row_height = Math.max(row_height, parent.getComponent(i).getMinimumSize().height);
    30
    break;
    13
    break;
    31
    case 1:
    14
    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);
    15
    row_height = Math.max(row_height, parent.getComponent(i).getMaximumSize().height);
    Differences
    Expression1Expression2Difference
    col_widthrow_heightVARIABLE_NAME_MISMATCH
    col_widthrow_heightVARIABLE_NAME_MISMATCH
    widthheightVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression parent.getComponent(i).getMaximumSize().width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression parent.getComponent(i).getMaximumSize().height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15
    row_height = Math.max(row_height, parent.getComponent(i).getMaximumSize().height);
    33
    break;
    16
    break;
    34
    default:
    17
    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);
    18
    row_height = Math.max(row_height, parent.getComponent(i).getPreferredSize().height);
    Differences
    Expression1Expression2Difference
    col_widthrow_heightVARIABLE_NAME_MISMATCH
    col_widthrow_heightVARIABLE_NAME_MISMATCH
    widthheightVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression parent.getComponent(i).getPreferredSize().width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression parent.getComponent(i).getPreferredSize().height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18
    row_height = Math.max(row_height, parent.getComponent(i).getPreferredSize().height);
    36
    break;
    19
    break;
    else
    else
    37
    break;
    37
    break;
    20
    break;
    Preondition Violations
    Statement break; without innermost loop
    Statement break; without innermost loop
    20
    break;
    Precondition Violations (8)
    Row Violation
    1Expression parent.getComponent(i).getMinimumSize().width cannot be parameterized, 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).getMaximumSize().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).getPreferredSize().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
    7Statement break; without innermost loop
    8Statement break; without innermost loop