int width = parent.getWidth() - insets.right; int rowHeight = Math.max(dim.height,closeBox.getPreferredSize().width); int x = rowHeight * 2 + insets.left; int y = insets.top; closeBox.setBounds(insets.left,insets.top,rowHeight,rowHeight); menuBtn.setBounds(insets.left + rowHeight,insets.top,rowHeight,rowHeight); for(int i = 2; i < comp.length; i++) { 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 height = parent.getHeight() - insets.bottom; int colWidth = Math.max(dim.width,closeBox.getPreferredSize().height); int x = insets.left; int y = colWidth * 2 + insets.top; closeBox.setBounds(insets.left,insets.top,colWidth,colWidth); menuBtn.setBounds(insets.left,insets.top + colWidth,colWidth,colWidth); for(int i = 2; i < comp.length; i++) { 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: 13 Number of AST nodes: 13
1
int width = parent.getWidth() - insets.right;
1
int height = parent.getHeight() - insets.bottom;
2
				int rowHeight = Math.max(dim.height,closeBox.getPreferredSize().width);
2
				int colWidth = Math.max(dim.width,closeBox.getPreferredSize().height);
3
				int x = rowHeight * 2 + insets.left;
3
				int x = insets.left;
4
				int y = insets.top;
4
				int y = colWidth * 2 + insets.top;
5
				closeBox.setBounds(insets.left,insets.top,rowHeight,rowHeight);
5
				closeBox.setBounds(insets.left,insets.top,colWidth,colWidth);
6
				menuBtn.setBounds(insets.left + rowHeight,insets.top,rowHeight,rowHeight);
6
				menuBtn.setBounds(insets.left,insets.top + colWidth,colWidth,colWidth);
7
				for(int i = 2; i < comp.length; i++)
7
				for(int i = 2; i < comp.length; i++)
8
				{
8
				{
9
					int btnWidth = comp[i].getPreferredSize().width;
9
					int btnHeight = comp[i].getPreferredSize().height;
10
					if(btnWidth + x > width)
10
					if(btnHeight + y > height)
11
					{
11
					{
12
						x = insets.left;
12
						x += colWidth;
13
						y += rowHeight;
13
						y = insets.top;
14
					}
14
					}
15
					comp[i].setBounds(x,y,btnWidth,rowHeight);
15
					comp[i].setBounds(x,y,colWidth,btnHeight);
16
					x += btnWidth;
16
					y += btnHeight;
17
				}
17
				}
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)1.2
Clones locationClones are in the same method
Number of node comparisons61
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)19.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    11
    int width = parent.getWidth() - insets.right;
    11
    int width = parent.getWidth() - insets.right;
    24
    int height = parent.getHeight() - insets.bottom;
    Differences
    Expression1Expression2Difference
    widthheightVARIABLE_NAME_MISMATCH
    getWidthgetHeightMETHOD_INVOCATION_NAME_MISMATCH
    rightbottomVARIABLE_NAME_MISMATCH
    24
    int height = parent.getHeight() - insets.bottom;
    12
    int rowHeight = Math.max(dim.height, closeBox.getPreferredSize().width);
    12
    int rowHeight = Math.max(dim.height, closeBox.getPreferredSize().width);
    25
    int colWidth = Math.max(dim.width, closeBox.getPreferredSize().height);
    Differences
    Expression1Expression2Difference
    rowHeightcolWidthVARIABLE_NAME_MISMATCH
    heightwidthVARIABLE_NAME_MISMATCH
    widthheightVARIABLE_NAME_MISMATCH
    25
    int colWidth = Math.max(dim.width, closeBox.getPreferredSize().height);
    13
    int x = rowHeight * 2 + insets.left;
    13
    int x = rowHeight * 2 + insets.left;
    27
    int y = colWidth * 2 + insets.top;
    Differences
    Expression1Expression2Difference
    xyVARIABLE_NAME_MISMATCH
    rowHeightcolWidthVARIABLE_NAME_MISMATCH
    lefttopVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression rowHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression colWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    27
    int y = colWidth * 2 + insets.top;
    14
    int y = insets.top;
    14
    int y = insets.top;
    26
    int x = insets.left;
    Differences
    Expression1Expression2Difference
    yxVARIABLE_NAME_MISMATCH
    topleftVARIABLE_NAME_MISMATCH
    26
    int x = insets.left;
    15
    closeBox.setBounds(insets.left, insets.top, rowHeight, rowHeight);
    15
    closeBox.setBounds(insets.left, insets.top, rowHeight, rowHeight);
    28
    closeBox.setBounds(insets.left, insets.top, colWidth, colWidth);
    Differences
    Expression1Expression2Difference
    rowHeightcolWidthVARIABLE_NAME_MISMATCH
    rowHeightcolWidthVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression rowHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression colWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression rowHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression colWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    28
    closeBox.setBounds(insets.left, insets.top, colWidth, colWidth);
    16
    menuBtn.setBounds(insets.left + rowHeight, insets.top, rowHeight, rowHeight);
    16
    menuBtn.setBounds(insets.left + rowHeight, insets.top, rowHeight, rowHeight);
    29
    menuBtn.setBounds(insets.left, insets.top + colWidth, colWidth, colWidth);
    Differences
    Expression1Expression2Difference
    insets.left + rowHeightinsets.leftTYPE_COMPATIBLE_REPLACEMENT
    insets.topinsets.top + colWidthTYPE_COMPATIBLE_REPLACEMENT
    rowHeightcolWidthVARIABLE_NAME_MISMATCH
    rowHeightcolWidthVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression insets.left + rowHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression insets.top + colWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression rowHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression colWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression rowHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression colWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    29
    menuBtn.setBounds(insets.left, insets.top + colWidth, colWidth, colWidth);
    17
    for (int i = 2; i < comp.length; i++)
    30
    for (int i = 2; i < comp.length; i++)
    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
    Expression comp[i].getPreferredSize().width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression comp[i].getPreferredSize().height 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
    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
    34
    y = insets.top;
    21
    y += rowHeight;
    21
    y += rowHeight;
    33
    x += colWidth;
    Differences
    Expression1Expression2Difference
    yxVARIABLE_NAME_MISMATCH
    rowHeightcolWidthVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression y 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 rowHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression colWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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 (30)
    Row Violation
    1Expression rowHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression colWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression rowHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression colWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression rowHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression colWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression insets.left + rowHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression insets.top + colWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression rowHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression colWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression rowHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression colWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression btnWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression btnHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression comp[i].getPreferredSize().width cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Expression comp[i].getPreferredSize().height cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression btnWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Expression btnHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    20Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    23Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    24Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    25Expression rowHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    26Expression colWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    27Expression x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    28Expression y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    29Expression btnWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    30Expression btnHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted