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: 23 | Number of AST nodes: 23 | |||
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 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 1.6 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 168 |
Number of mapped statements | 21 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 13.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6 | if (position.equals(DockableWindowManager.TOP) || position.equals(DockableWindowManager.BOTTOM)) | 6 | if (position.equals(DockableWindowManager.TOP) || position.equals(DockableWindowManager.BOTTOM)) | |||||||||||
7 | int width = dimension - insets.right; |
| 7 | int width = parent.getWidth() - insets.right; | ||||||||||
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; | |||||||||||
| 17 | return returnValue; | ||||||||||||
17 | return returnValue.height; | | ||||||||||||
else | else | |||||||||||||
18 | int height = dimension - insets.bottom; |
| 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; | |
Row | Violation |
---|---|
1 | Clone fragment #1 returns variables returnValue, returnValue , while Clone fragment #2 returns variables returnValue, returnValue |