int height = dimension - insets.bottom; int colWidth = Math.max(dim.width,closeBox.getPreferredSize().height); int y = colWidth * 2 + insets.top; Dimension returnValue = new Dimension(colWidth + insets.left + insets.right,0); for(int i = 2; i < comp.length; i++) { int btnHeight = comp[i].getPreferredSize().height; if(btnHeight + y > height) { returnValue.width += colWidth; y = insets.top; } y += btnHeight; } return returnValue.width;
int height = parent.getHeight() - insets.bottom; int colWidth = Math.max(dim.width,closeBox.getPreferredSize().height); int y = colWidth * 2 + insets.top; Dimension returnValue = new Dimension(colWidth + insets.left + insets.right,0); for(int i = 2; i < comp.length; i++) { int btnHeight = comp[i].getPreferredSize().height; if(btnHeight + y > height) { returnValue.width += colWidth; y = insets.top; } y += btnHeight; } return returnValue;
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: Dimension preferredLayoutSize(Container)
Number of AST nodes: 11 Number of AST nodes: 11
1
int height = dimension - insets.bottom;
1
int height = parent.getHeight() - insets.bottom;
2
				int colWidth = Math.max(dim.width,closeBox.getPreferredSize().height);
2
				int colWidth = Math.max(dim.width,closeBox.getPreferredSize().height);
3
				int y = colWidth * 2 + insets.top;
3
				int y = colWidth * 2 + insets.top;
4
				Dimension returnValue = new Dimension(colWidth
4
				Dimension returnValue = new Dimension(colWidth
5
					+ insets.left + insets.right,0);
5
					+ insets.left + insets.right,0);
6
				for(int i = 2; i < comp.length; i++)
6
				for(int i = 2; i < comp.length; i++)
7
				{
7
				{
8
					int btnHeight = comp[i].getPreferredSize().height;
8
					int btnHeight = comp[i].getPreferredSize().height;
9
					if(btnHeight + y > height)
9
					if(btnHeight + y > height)
10
					{
10
					{
11
						returnValue.width += colWidth;
11
						returnValue.width += colWidth;
12
						y = insets.top;
12
						y = insets.top;
13
					}
13
					}
14
					y += btnHeight;
14
					y += btnHeight;
15
				}
15
				}
16
				return returnValue.width;
16
				return returnValue;
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 declared in the same class
Number of node comparisons38
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)3.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    18
    int height = dimension - insets.bottom;
    18
    int height = dimension - insets.bottom;
    18
    int height = parent.getHeight() - insets.bottom;
    Differences
    Expression1Expression2Difference
    dimensionparent.getHeight()TYPE_COMPATIBLE_REPLACEMENT
    18
    int height = parent.getHeight() - insets.bottom;
    19
    int colWidth = Math.max(dim.width, closeBox.getPreferredSize().height);
    19
    int colWidth = Math.max(dim.width, closeBox.getPreferredSize().height);
    20
    int y = colWidth * 2 + insets.top;
    20
    int y = colWidth * 2 + insets.top;
    21
    Dimension returnValue = new Dimension(colWidth + insets.left + insets.right, 0);
    21
    Dimension returnValue = new Dimension(colWidth + insets.left + insets.right, 0);
    22
    for (int i = 2; i < comp.length; i++)
    22
    for (int i = 2; i < comp.length; i++)
    23
    int btnHeight = comp[i].getPreferredSize().height;
    23
    int btnHeight = comp[i].getPreferredSize().height;
    24
    if (btnHeight + y > height)
    24
    if (btnHeight + y > height)
    25
    returnValue.width += colWidth;
    25
    returnValue.width += colWidth;
    26
    y = insets.top;
    26
    y = insets.top;
    27
    y += btnHeight;
    27
    y += btnHeight;
                                                  
    28
    return returnValue;
    28
    return returnValue.width;
                                                              
    Precondition Violations (0)
    Row Violation