if(position.equals(DockableWindowManager.TOP) || position.equals(DockableWindowManager.BOTTOM)) { int width = dimension - insets.right; 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; } return returnValue.height; } else { 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; }
if(position.equals(DockableWindowManager.TOP) || position.equals(DockableWindowManager.BOTTOM)) { int width = parent.getWidth() - insets.right; 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; } return returnValue; } else { 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: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
if(position.equals(DockableWindowManager.TOP)
1
if(position.equals(DockableWindowManager.TOP)
2
				|| position.equals(DockableWindowManager.BOTTOM))
2
				|| position.equals(DockableWindowManager.BOTTOM))
3
			{
3
			{
4
				int width = dimension - insets.right;
4
				int width = parent.getWidth() - insets.right;
5
				int rowHeight = Math.max(dim.height,closeBox.getPreferredSize().width);
5
				int rowHeight = Math.max(dim.height,closeBox.getPreferredSize().width);
6
				int x = rowHeight * 2 + insets.left;
6
				int x = rowHeight * 2 + insets.left;
7
				Dimension returnValue = new Dimension(0,rowHeight
7
				Dimension returnValue = new Dimension(0,rowHeight
8
					+ insets.top + insets.bottom);
8
					+ insets.top + insets.bottom);
9
				for(int i = 2; i < comp.length; i++)
9
				for(int i = 2; i < comp.length; i++)
10
				{
10
				{
11
					int btnWidth = comp[i].getPreferredSize().width;
11
					int btnWidth = comp[i].getPreferredSize().width;
12
					if(btnWidth + x > width)
12
					if(btnWidth + x > width)
13
					{
13
					{
14
						returnValue.height += rowHeight;
14
						returnValue.height += rowHeight;
15
						x = insets.left;
15
						x = insets.left;
16
					}
16
					}
17
					x += btnWidth;
17
					x += btnWidth;
18
				}
18
				}
19
				return returnValue.height;
19
				return returnValue;
20
			}
20
			}
21
			else
21
			else
22
			{
22
			{
23
				int height = dimension - insets.bottom;
23
				int height = parent.getHeight() - insets.bottom;
24
				int colWidth = Math.max(dim.width,closeBox.getPreferredSize().height);
24
				int colWidth = Math.max(dim.width,closeBox.getPreferredSize().height);
25
				int y = colWidth * 2 + insets.top;
25
				int y = colWidth * 2 + insets.top;
26
				Dimension returnValue = new Dimension(colWidth
26
				Dimension returnValue = new Dimension(colWidth
27
					+ insets.left + insets.right,0);
27
					+ insets.left + insets.right,0);
28
				for(int i = 2; i < comp.length; i++)
28
				for(int i = 2; i < comp.length; i++)
29
				{
29
				{
30
					int btnHeight = comp[i].getPreferredSize().height;
30
					int btnHeight = comp[i].getPreferredSize().height;
31
					if(btnHeight + y > height)
31
					if(btnHeight + y > height)
32
					{
32
					{
33
						returnValue.width += colWidth;
33
						returnValue.width += colWidth;
34
						y = insets.top;
34
						y = insets.top;
35
					}
35
					}
36
					y += btnHeight;
36
					y += btnHeight;
37
				}
37
				}
38
				return returnValue.width;
38
				return returnValue;
39
			}
39
			}
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0