if (total_width != free_width) { double dx = ((double)free_width) / ((double)total_width); for (int c = 0; c < ncols; c++) { col_widths[c] = (int) ((double)col_widths[c] * dx); } }
if (total_height != free_height) { double dy = (double)free_height / (double)total_height; for (int r = 0; r < nrows; r++) { row_heights[r] = (int) ((double)row_heights[r] * dy); } }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/VariableGridLayout.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/VariableGridLayout.java
Method name: void layoutContainer(Container) Method name: void layoutContainer(Container)
Number of AST nodes: 4 Number of AST nodes: 4
1
if (total_width != free_width) {
1
if (total_height != free_height) {
2
				double dx = ((double)free_width) / ((double)total_width);
2
				double dy = (double)free_height / (double)total_height;
3
				for (int c = 0; c < ncols; c++) {
3
				for (int r = 0; r < nrows; r++) {
4
					col_widths[c] = (int) ((double)col_widths[c] * dx);
4
					row_heights[r] = (int) ((double)row_heights[r] * dy);
5
				}
5
				}
6
			}
6
			}
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 comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    26
    if (total_width != free_width)
    26
    if (total_width != free_width)
    22
    if (total_height != free_height)
    Differences
    Expression1Expression2Difference
    total_widthtotal_heightVARIABLE_NAME_MISMATCH
    free_widthfree_heightVARIABLE_NAME_MISMATCH
    22
    if (total_height != free_height)
    27
    double dx = ((double)free_width) / ((double)total_width);
    27
    double dx = ((double)free_width) / ((double)total_width);
    23
    double dy = (double)free_height / (double)total_height;
    Differences
    Expression1Expression2Difference
    dxdyVARIABLE_NAME_MISMATCH
    ((double)free_width)(double)free_heightTYPE_COMPATIBLE_REPLACEMENT
    ((double)total_width)(double)total_heightTYPE_COMPATIBLE_REPLACEMENT
    23
    double dy = (double)free_height / (double)total_height;
    28
    for (int c = 0; c < ncols; c++)
    28
    for (int c = 0; c < ncols; c++)
    24
    for (int r = 0; r < nrows; r++)
    Differences
    Expression1Expression2Difference
    crVARIABLE_NAME_MISMATCH
    crVARIABLE_NAME_MISMATCH
    ncolsnrowsVARIABLE_NAME_MISMATCH
    crVARIABLE_NAME_MISMATCH
    24
    for (int r = 0; r < nrows; r++)
    29
    col_widths[c] = (int)((double)col_widths[c] * dx);
    29
    col_widths[c] = (int)((double)col_widths[c] * dx);
    25
    row_heights[r] = (int)((double)row_heights[r] * dy);
    Differences
    Expression1Expression2Difference
    col_widthsrow_heightsVARIABLE_NAME_MISMATCH
    crVARIABLE_NAME_MISMATCH
    col_widthsrow_heightsVARIABLE_NAME_MISMATCH
    crVARIABLE_NAME_MISMATCH
    dxdyVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression col_widths cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression row_heights cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression col_widths cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression row_heights cannot be parameterized, because it has dependencies to/from statements that will be extracted
    25
    row_heights[r] = (int)((double)row_heights[r] * dy);
    Precondition Violations (4)
    Row Violation
    1Expression col_widths cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression row_heights cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression col_widths cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression row_heights cannot be parameterized, because it has dependencies to/from statements that will be extracted