int btnWidth = comp[i].getPreferredSize().width; if(btnWidth + x > width) { x = insets.left; y += rowHeight; } comp[i].setBounds(x,y,btnWidth,rowHeight); x += btnWidth;
int btnHeight = comp[i].getPreferredSize().height; if(btnHeight + y > height) { x += colWidth; y = insets.top; } comp[i].setBounds(x,y,colWidth,btnHeight); y += btnHeight;
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: void layoutContainer(Container) Method name: void layoutContainer(Container)
Number of AST nodes: 6 Number of AST nodes: 6
1
int btnWidth = comp[i].getPreferredSize().width;
1
int btnHeight = comp[i].getPreferredSize().height;
2
					if(btnWidth + x > width)
2
					if(btnHeight + y > height)
3
					{
3
					{
4
						x = insets.left;
4
						x += colWidth;
5
						y += rowHeight;
5
						y = insets.top;
6
					}
6
					}
7
					comp[i].setBounds(x,y,btnWidth,rowHeight);
7
					comp[i].setBounds(x,y,colWidth,btnHeight);
8
					x += btnWidth;
8
					y += btnHeight;
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 comparisons19
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    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.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    18
    int btnWidth = comp[i].getPreferredSize().width;
    18
    int btnWidth = comp[i].getPreferredSize().width;
    31
    int btnHeight = comp[i].getPreferredSize().height;
    Differences
    Expression1Expression2Difference
    btnWidthbtnHeightVARIABLE_NAME_MISMATCH
    widthheightVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression btnWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression btnHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    31
    int btnHeight = comp[i].getPreferredSize().height;
    19
    if (btnWidth + x > width)
    19
    if (btnWidth + x > width)
    32
    if (btnHeight + y > height)
    Differences
    Expression1Expression2Difference
    btnWidthbtnHeightVARIABLE_NAME_MISMATCH
    xyVARIABLE_NAME_MISMATCH
    widthheightVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression btnWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression btnHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    32
    if (btnHeight + y > height)
    20
    x = insets.left;
    20
    x = insets.left;
    34
    y = insets.top;
    Differences
    Expression1Expression2Difference
    xyVARIABLE_NAME_MISMATCH
    lefttopVARIABLE_NAME_MISMATCH
    34
    y = insets.top;
    21
    y += rowHeight;
    21
    y += rowHeight;
    33
    x += colWidth;
    Differences
    Expression1Expression2Difference
    yxVARIABLE_NAME_MISMATCH
    rowHeightcolWidthVARIABLE_NAME_MISMATCH
    33
    x += colWidth;
    22
    comp[i].setBounds(x, y, btnWidth, rowHeight);
    22
    comp[i].setBounds(x, y, btnWidth, rowHeight);
    35
    comp[i].setBounds(x, y, colWidth, btnHeight);
    Differences
    Expression1Expression2Difference
    btnWidthcolWidthVARIABLE_NAME_MISMATCH
    rowHeightbtnHeightVARIABLE_NAME_MISMATCH
    35
    comp[i].setBounds(x, y, colWidth, btnHeight);
    23
    x += btnWidth;
    23
    x += btnWidth;
    36
    y += btnHeight;
    Differences
    Expression1Expression2Difference
    xyVARIABLE_NAME_MISMATCH
    btnWidthbtnHeightVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression btnWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression btnHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    36
    y += btnHeight;
    Precondition Violations (11)
    Row Violation
    1Expression btnWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression btnHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression btnWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression btnHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression btnWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression btnHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Clone fragment #1 returns variables x, y , while Clone fragment #2 returns variables y, x