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;
}
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: 6
|
|
Number of AST nodes: 6
|
|
1 | for(int i = 2; i < comp.length; i++)↵ | | 1 | for(int i = 2; i < comp.length; i++)↵
|
2 | {↵ | | 2 | {↵
|
3 | int btnWidth = comp[i].getPreferredSize().width;↵ | | 3 | int btnWidth = comp[i].getPreferredSize().width;↵
|
4 | if(btnWidth + x > width)↵ | | 4 | if(btnWidth + x > width)↵
|
5 | {↵ | | 5 | {↵
|
6 | returnValue.height += rowHeight;↵ | | 6 | returnValue.height += rowHeight;↵
|
7 | x = insets.left;↵ | | 7 | x = insets.left;↵
|
8 | }↵ | | 8 | }↵
|
|
9 | x += btnWidth;↵ | | 9 | x += btnWidth;↵
|
10 | } | | 10 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 19 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.1 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
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 | | | 15 | |
16 | | | 16 | |
Precondition Violations (0)
Row |
Violation |