int rowHeight = Math.max(dim.height,closeBox.getPreferredSize().width); int x = rowHeight * 2 + insets.left; Dimension returnValue = new Dimension(0,rowHeight + insets.top + insets.bottom); for(int i = 2; i < comp.length; i++) { int btnWidth = comp[i].getPreferredSize().width; if(btnWidth + x > width) { returnValue.height += rowHeight; x = insets.left; } x += btnWidth; }
int rowHeight = Math.max(dim.height,closeBox.getPreferredSize().width); int x = rowHeight * 2 + insets.left; Dimension returnValue = new Dimension(0,rowHeight + insets.top + insets.bottom); for(int i = 2; i < comp.length; i++) { 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: Dimension preferredLayoutSize(Container) Method name: int getWrappedDimension(JComponent, int)
Number of AST nodes: 9 Number of AST nodes: 9
1
int rowHeight = Math.max(dim.height,closeBox.getPreferredSize().width);
1
int rowHeight = Math.max(dim.height,closeBox.getPreferredSize().width);
2
				int x = rowHeight * 2 + insets.left;
2
				int x = rowHeight * 2 + insets.left;
3
				Dimension returnValue = new Dimension(0,rowHeight
3
				Dimension returnValue = new Dimension(0,rowHeight
4
					+ insets.top + insets.bottom);
4
					+ insets.top + insets.bottom);
5
				for(int i = 2; i < comp.length; i++)
5
				for(int i = 2; i < comp.length; i++)
6
				{
6
				{
7
					int btnWidth = comp[i].getPreferredSize().width;
7
					int btnWidth = comp[i].getPreferredSize().width;
8
					if(btnWidth + x > width)
8
					if(btnWidth + x > width)
9
					{
9
					{
10
						returnValue.height += rowHeight;
10
						returnValue.height += rowHeight;
11
						x = insets.left;
11
						x = insets.left;
12
					}
12
					}
13
					x += btnWidth;
13
					x += btnWidth;
14
				}
14
				}
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)0.6
Clones locationClones are declared in the same class
Number of node comparisons24
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.9
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    8
    int rowHeight = Math.max(dim.height, closeBox.getPreferredSize().width);
    8
    int rowHeight = Math.max(dim.height, closeBox.getPreferredSize().width);
    9
    int x = rowHeight * 2 + insets.left;
    9
    int x = rowHeight * 2 + insets.left;
    10
    Dimension returnValue = new Dimension(0, rowHeight + insets.top + insets.bottom);
    10
    Dimension returnValue = new Dimension(0, rowHeight + insets.top + insets.bottom);
    11
    for (int i = 2; i < comp.length; i++)
    11
    for (int i = 2; i < comp.length; i++)
    12
    int btnWidth = comp[i].getPreferredSize().width;
    12
    int btnWidth = comp[i].getPreferredSize().width;
    13
    if (btnWidth + x > width)
    13
    if (btnWidth + x > width)
    14
    returnValue.height += rowHeight;
    14
    returnValue.height += rowHeight;
    15
    x = insets.left;
    15
    x = insets.left;
    16
    x += btnWidth;
    16
    x += btnWidth;
    Precondition Violations (0)
    Row Violation