int btnHeight = comp[i].getPreferredSize().height; if(btnHeight + y > height) { returnValue.width += colWidth; y = insets.top; } y += btnHeight;
int btnWidth = comp[i].getPreferredSize().width; if(btnWidth + x > width) { returnValue.height += rowHeight; x = insets.left; } x += btnWidth;
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/PanelWindowContainer.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/PanelWindowContainer.java
Method name: int getWrappedDimension(JComponent, int) Method name: int getWrappedDimension(JComponent, int)
Number of AST nodes: 5 Number of AST nodes: 5
1
int btnHeight = comp[i].getPreferredSize().height;
1
int btnWidth = comp[i].getPreferredSize().width;
2
					if(btnHeight + y > height)
2
					if(btnWidth + x > width)
3
					{
3
					{
4
						returnValue.width += colWidth;
4
						returnValue.height += rowHeight;
5
						y = insets.top;
5
						x = insets.left;
6
					}
6
					}
7
					y += btnHeight;
7
					x += btnWidth;
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 comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    23
    int btnHeight = comp[i].getPreferredSize().height;
    23
    int btnHeight = comp[i].getPreferredSize().height;
    12
    int btnWidth = comp[i].getPreferredSize().width;
    Differences
    Expression1Expression2Difference
    btnHeightbtnWidthVARIABLE_NAME_MISMATCH
    heightwidthVARIABLE_NAME_MISMATCH
    12
    int btnWidth = comp[i].getPreferredSize().width;
    24
    if (btnHeight + y > height)
    24
    if (btnHeight + y > height)
    13
    if (btnWidth + x > width)
    Differences
    Expression1Expression2Difference
    btnHeightbtnWidthVARIABLE_NAME_MISMATCH
    yxVARIABLE_NAME_MISMATCH
    heightwidthVARIABLE_NAME_MISMATCH
    13
    if (btnWidth + x > width)
    25
    returnValue.width += colWidth;
    25
    returnValue.width += colWidth;
    14
    returnValue.height += rowHeight;
    Differences
    Expression1Expression2Difference
    widthheightVARIABLE_NAME_MISMATCH
    colWidthrowHeightVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression returnValue.width is a field being modified, and thus it cannot be parameterized
    Expression returnValue.height is a field being modified, and thus it cannot be parameterized
    14
    returnValue.height += rowHeight;
    26
    y = insets.top;
    26
    y = insets.top;
    15
    x = insets.left;
    Differences
    Expression1Expression2Difference
    yxVARIABLE_NAME_MISMATCH
    topleftVARIABLE_NAME_MISMATCH
    15
    x = insets.left;
    27
    y += btnHeight;
    27
    y += btnHeight;
    16
    x += btnWidth;
    Differences
    Expression1Expression2Difference
    yxVARIABLE_NAME_MISMATCH
    btnHeightbtnWidthVARIABLE_NAME_MISMATCH
    16
    x += btnWidth;
    Precondition Violations (2)
    Row Violation
    1Expression returnValue.width is a field being modified, and thus it cannot be parameterized
    2Expression returnValue.height is a field being modified, and thus it cannot be parameterized