int ncomponents = container.getComponentCount(); int old_nrows = nrows; int old_ncols = ncols; if (this.mode == FIXED_NUM_ROWS) { nrows = this.size; ncols = (ncomponents + nrows - 1) / nrows; } else { ncols = this.size; nrows = (ncomponents + ncols - 1) / ncols; } if (old_nrows != nrows) { row_heights = new int[nrows]; } if (old_ncols != ncols) { col_widths = new int[ncols]; }
int ncomponents = container.getComponentCount(); int old_nrows = nrows; int old_ncols = ncols; if (this.mode == FIXED_NUM_ROWS) { nrows = this.size; ncols = (ncomponents + nrows - 1) / nrows; } else { ncols = this.size; nrows = (ncomponents + ncols - 1) / ncols; } if (old_nrows != nrows) { row_heights = new int[nrows]; } if (old_ncols != ncols) { col_widths = new int[ncols]; }
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: void update(Container) Method name: void update(Container)
Number of AST nodes: 12 Number of AST nodes: 12
1
int ncomponents = container.getComponentCount();
1
int ncomponents = container.getComponentCount();
2
		int old_nrows = nrows;
2
		int old_nrows = nrows;
3
		int old_ncols = ncols;
3
		int old_ncols = ncols;
4
		if (this.mode == FIXED_NUM_ROWS) {
4
		if (this.mode == FIXED_NUM_ROWS) {
5
			nrows = this.size;
5
			nrows = this.size;
6
			ncols = (ncomponents + nrows - 1) / nrows;
6
			ncols = (ncomponents + nrows - 1) / nrows;
7
		} else {
7
		} else {
8
			ncols = this.size;
8
			ncols = this.size;
9
			nrows = (ncomponents + ncols - 1) / ncols;
9
			nrows = (ncomponents + ncols - 1) / ncols;
10
		}
10
		}
11
		if (old_nrows != nrows) {
11
		if (old_nrows != nrows) {
12
			row_heights = new int[nrows];
12
			row_heights = new int[nrows];
13
		}
13
		}
14
		if (old_ncols != ncols) {
14
		if (old_ncols != ncols) {
15
			col_widths = new int[ncols];
15
			col_widths = new int[ncols];
16
		}
16
		}
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)1.1
Clones locationClones are in different classes
Number of node comparisons51
  1. {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)7.6
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    1
    int ncomponents = container.getComponentCount();
    1
    int ncomponents = container.getComponentCount();
    2
    int old_nrows = nrows;
    2
    int old_nrows = nrows;
    3
    int old_ncols = ncols;
    3
    int old_ncols = ncols;
    4
    if (this.mode == FIXED_NUM_ROWS)
    4
    if (this.mode == FIXED_NUM_ROWS)
    5
    nrows = this.size;
    5
    nrows = this.size;
    6
    ncols = (ncomponents + nrows - 1) / nrows;
    6
    ncols = (ncomponents + nrows - 1) / nrows;
    else
    else
    7
    ncols = this.size;
    7
    ncols = this.size;
    8
    nrows = (ncomponents + ncols - 1) / ncols;
    8
    nrows = (ncomponents + ncols - 1) / ncols;
    9
    if (old_nrows != nrows)
    9
    if (old_nrows != nrows)
    10
    row_heights = new int[nrows];
    10
    row_heights = new int[nrows];
    11
    if (old_ncols != ncols)
    11
    if (old_ncols != ncols)
    12
    col_widths = new int[ncols];
    12
    col_widths = new int[ncols];
    Precondition Violations (0)
    Row Violation