File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/frame/FrameManager.java | File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/tree/TreeView.java | |||
Method name: ViewItem loadDefaultView(String)
|
Method name: void expand(IMailFolder)
|
|||
Number of AST nodes: 12 | Number of AST nodes: 12 | |||
1 | if (defaultViews == null) {↵ | |||
2 | XmlElement gui = Config.getInstance().get("views").getElement(↵ | |||
3 | "/views↵ | 1 | IFolderItem item = parent.getConfiguration();↵ | |
4 | ");↵ | 2 | XmlElement property = item.getElement("property");↵ | |
5 | ↵ | |||
6 | defaultViews = new XmlElement("defaultviews↵ | 3 | if (property != null) {↵ | |
7 | ");↵ | 4 | String expanded = property.getAttribute("expanded");↵ | |
8 | gui.addElement(defaultViews)↵ | 5 | if (expanded == null) {↵ | |
9 | ;↵ | 6 | expanded = "true";↵ | |
10 | }↵ | 7 | }↵ | |
11 | // search through defaultViews to get settings for given id↵ | 8 | // ↵ | |
12 | ViewItem view = null;↵ | |||
9 | expand folder↵ | |||
10 | int row = getRowForPath(new TreePath(parent.getPath()));↵ | |||
11 | if (expanded.equals("true")) {↵ | |||
12 | expandRow(row);↵ | |||
13 | }↵ | |||
14 | }↵ | |||
15 | // recursivly expand all children↵ | |||
13 | for (int i = 0; i < defaultViews.count(); i++) {↵ | 16 | for (int i = 0; i < parent.getChildCount(); i++) {↵ | |
14 | XmlElement child = defaultViews.getElement(i);↵ | 17 | ↵ | |
15 | String childId = child.getAttribute("id");↵ | 18 | IMailFolder child = (IMailFolder) parent.getChildAt(i);↵ | |
16 | if ((childId != null) && childId.equals(id)) {↵ | 19 | ↵ | |
17 | view = new ViewItem(child);↵ | |||
18 | break;↵ | |||
19 | }↵ | |||
20 | }↵ | |||
21 | return view; | 20 | expand(child);↵ | |
21 |
| |||
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) | 0.3 |
Clones location | Clones are in different classes |
Number of node comparisons | 10 |
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 11 |
Number of unmapped statements in the second code fragment | 11 |
Time elapsed for statement mapping (ms) | 5.8 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (defaultViews == null) | | |||||||||||||||||||||
2 | XmlElement gui = Config.getInstance().get("views").getElement("/views"); | | |||||||||||||||||||||
3 | defaultViews = new XmlElement("defaultviews"); |
| | ||||||||||||||||||||
4 | gui.addElement(defaultViews); |
| | ||||||||||||||||||||
5 | ViewItem view = null; |
| 1 | IFolderItem item = parent.getConfiguration(); | |||||||||||||||||||
|
| 2 | XmlElement property = item.getElement("property"); | ||||||||||||||||||||
| 3 | if (property != null) | |||||||||||||||||||||
| 4 | String expanded = property.getAttribute("expanded"); | |||||||||||||||||||||
| 5 | if (expanded == null) | |||||||||||||||||||||
| 6 | expanded = "true"; | |||||||||||||||||||||
| 7 | int row = getRowForPath(new TreePath(parent.getPath())); | |||||||||||||||||||||
| 8 | if (expanded.equals("true")) | |||||||||||||||||||||
|
| 9 | expandRow(row); | ||||||||||||||||||||
6 | for (int i = 0; i < defaultViews.count(); i++) | | |||||||||||||||||||||
7 | XmlElement child = defaultViews.getElement(i); | | |||||||||||||||||||||
8 | String childId = child.getAttribute("id"); | | |||||||||||||||||||||
9 | if ((childId != null) && childId.equals(id)) | | |||||||||||||||||||||
10 | view = new ViewItem(child); |
| | ||||||||||||||||||||
11 | break; |
| | ||||||||||||||||||||
| 10 | for (int i = 0; i < parent.getChildCount(); i++) | |||||||||||||||||||||
| 11 | IMailFolder child = (IMailFolder)parent.getChildAt(i); | |||||||||||||||||||||
| 12 | expand(child); | |||||||||||||||||||||
12 | return view; |
| |
Row | Violation |
---|---|
1 | Unmatched statement defaultViews=new XmlElement("defaultviews"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement gui.addElement(defaultViews); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched statement XmlElement property=item.getElement("property"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement expandRow(row); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
5 | Unmatched statement view=new ViewItem(child); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched break; |
7 | Unmatched statement return view; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
8 | Unmatched return view; |
9 | Clone fragment #1 returns variable view with type org.columba.core.config.ViewItem , while Clone fragment #2 returns variable item with type org.columba.mail.config.IFolderItem |
10 | The refactoring of the clones is infeasible, because classes org.columba.core.gui.frame.FrameManager and org.columba.mail.gui.tree.TreeView do not have a common superclass |