JButton button = ToolBarButtonFactory.createButton(action);
add(button, position);
if (position >= insertPosition)
insertPosition++;
JButton button = ToolBarButtonFactory.createButton(action);
add(button, insertPosition);
insertPosition++;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/toolbar/ExtendableToolBar.java
|
|
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/toolbar/ExtendableToolBar.java
|
Method name: void insert(AbstractColumbaAction, int)
|
|
Method name: void add(AbstractColumbaAction)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 3
|
|
1 | JButton button = ToolBarButtonFactory.createButton(action);↵ | | 1 | JButton button = ToolBarButtonFactory.createButton(action);↵
|
|
2 | add(button, position);↵ | | 2 | add(button,↵
|
|
3 | if (position >= insertPosition)↵ | | 3 | insertPosition);↵
|
|
4 | insertPosition++; | | 4 | insertPosition++;
|
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.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 6 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | JButton button = ToolBarButtonFactory.createButton(action); | | 1 | JButton button = ToolBarButtonFactory.createButton(action); |
2 | add(button, position); | | 2 | add(button, insertPosition); |
| | | 3 | insertPosition++; |
Precondition Violations (1)
Row |
Violation |
1 | Unmatched statement insertPosition++; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |