File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/context/ContactContextualProvider.java | File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/context/ContactDetailsContextualProvider.java | |||
Method name: void search(ISemanticContext, int, int)
|
Method name: void search(ISemanticContext, int, int)
|
|||
Number of AST nodes: 18 | Number of AST nodes: 19 | |||
1 | IStructureValue value = context.getValue();↵ | 1 | IStructureValue value = context.getValue();↵ | |
2 | if ( value == null ) ↵ | 2 | if (value == null)↵ | |
3 | return;↵ | 3 | return;↵ | |
4 | ↵ | |||
5 | Iterator<IStructureValue> it = value.getChildIterator(↵ | 4 | Iterator<IStructureValue> it = value.getChildIterator(↵ | |
6 | ISemanticContext.CONTEXT_NODE_IDENTITY,↵ | 5 | ISemanticContext.CONTEXT_NODE_IDENTITY,↵ | |
7 | ISemanticContext.CONTEXT_NAMESPACE_CORE);↵ | 6 | ISemanticContext.CONTEXT_NAMESPACE_CORE);↵ | |
8 | ↵ | 7 | if (it.hasNext()) {↵ | |
9 | // can be only one↵ | 8 | // can be only one↵ | |
10 | IStructureValue identity = it.next();↵ | 9 | IStructureValue identity = it.next();↵ | |
11 | if (identity == null)↵ | 10 | if (identity == null)↵ | |
12 | return;↵ | 11 | return;↵ | |
13 | String emailAddress = identity.getString(↵ | 12 | String emailAddress = identity.getString(↵ | |
14 | ISemanticContext.CONTEXT_ATTR_EMAIL_ADDRESS,↵ | 13 | ISemanticContext.CONTEXT_ATTR_EMAIL_ADDRESS,↵ | |
15 | ISemanticContext.CONTEXT_NAMESPACE_CORE);↵ | 14 | ISemanticContext.CONTEXT_NAMESPACE_CORE);↵ | |
16 | String displayname = identity.getString(↵ | 15 | String displayname = identity.getString(↵ | |
17 | ISemanticContext.CONTEXT_ATTR_DISPLAY_NAME,↵ | 16 | ISemanticContext.CONTEXT_ATTR_DISPLAY_NAME,↵ | |
18 | ISemanticContext.CONTEXT_NAMESPACE_CORE);↵ | 17 | ISemanticContext.CONTEXT_NAMESPACE_CORE);↵ | |
19 | if (emailAddress == null && displayname == null)↵ | 18 | if (emailAddress == null && displayname == null)↵ | |
20 | return;↵ | 19 | return;↵ | |
21 | List<ISearchResult> temp;↵ | 20 | List<ISearchResult> temp;↵ | |
22 | if (emailAddress != null) {↵ | 21 | if (emailAddress != null) {↵ | |
23 | temp = searchProvider.query(emailAddress,↵ | 22 | temp = searchProvider.query(emailAddress,↵ | |
24 | ContactSearchProvider.CRITERIA_EMAIL_CONTAINS, false, ↵ | 23 | ContactSearchProvider.CRITERIA_EMAIL_CONTAINS, false,↵ | |
25 | 0, 5);↵ | 24 | 0, 5);↵ | |
26 | result.addAll(temp);↵ | 25 | result.addAll(temp);↵ | |
27 | }↵ | 26 | }↵ | |
28 | if (displayname != null) {↵ | 27 | if (displayname != null) {↵ | |
29 | temp = searchProvider.query(displayname,↵ | 28 | temp = searchProvider.query(displayname,↵ | |
30 | ContactSearchProvider.CRITERIA_DISPLAYNAME_CONTAINS, ↵ | 29 | ContactSearchProvider.CRITERIA_DISPLAYNAME_CONTAINS,↵ | |
31 | false, 0, 5);↵ | 30 | false, 0, 5);↵ | |
32 | result.addAll(temp);↵ | 31 | result.addAll(temp);↵ | |
33 | ↵ | 32 | }↵ | |
34 | } | 33 | } | |
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.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 97 |
Number of mapped statements | 14 |
Number of unmapped statements in the first code fragment | 4 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 44.7 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | IStructureValue value = context.getValue(); | | |||||||||||||
2 | if (value == null) |
| 7 | if (identity == null) | |||||||||||
3 | return; |
| 8 | return; | |||||||||||
4 | Iterator<IStructureValue> it = value.getChildIterator(ISemanticContext.CONTEXT_NODE_IDENTITY, ISemanticContext.CONTEXT_NAMESPACE_CORE); | | |||||||||||||
5 | IStructureValue identity = it.next(); | 6 | IStructureValue identity = it.next(); | ||||||||||||
6 | if (identity == null) | | |||||||||||||
7 | return; |
| | ||||||||||||
8 | String emailAddress = identity.getString(ISemanticContext.CONTEXT_ATTR_EMAIL_ADDRESS, ISemanticContext.CONTEXT_NAMESPACE_CORE); | 9 | String emailAddress = identity.getString(ISemanticContext.CONTEXT_ATTR_EMAIL_ADDRESS, ISemanticContext.CONTEXT_NAMESPACE_CORE); | ||||||||||||
9 | String displayname = identity.getString(ISemanticContext.CONTEXT_ATTR_DISPLAY_NAME, ISemanticContext.CONTEXT_NAMESPACE_CORE); | 10 | String displayname = identity.getString(ISemanticContext.CONTEXT_ATTR_DISPLAY_NAME, ISemanticContext.CONTEXT_NAMESPACE_CORE); | ||||||||||||
10 | if (emailAddress == null && displayname == null) | 11 | if (emailAddress == null && displayname == null) | ||||||||||||
11 | return; |
| 12 | return; | |||||||||||
12 | List<ISearchResult> temp; | 13 | List<ISearchResult> temp; | ||||||||||||
13 | if (emailAddress != null) | 14 | if (emailAddress != null) | ||||||||||||
14 | temp = searchProvider.query(emailAddress, ContactSearchProvider.CRITERIA_EMAIL_CONTAINS, false, 0, 5); | 15 | temp = searchProvider.query(emailAddress, ContactSearchProvider.CRITERIA_EMAIL_CONTAINS, false, 0, 5); | ||||||||||||
15 | result.addAll(temp); | 16 | result.addAll(temp); | ||||||||||||
16 | if (displayname != null) | 17 | if (displayname != null) | ||||||||||||
17 | temp = searchProvider.query(displayname, ContactSearchProvider.CRITERIA_DISPLAYNAME_CONTAINS, false, 0, 5); | 18 | temp = searchProvider.query(displayname, ContactSearchProvider.CRITERIA_DISPLAYNAME_CONTAINS, false, 0, 5); | ||||||||||||
18 | result.addAll(temp); | 19 | result.addAll(temp); |
Row | Violation |
---|---|
1 | Expression identity cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Conditional return; |
3 | Conditional return; |
4 | Unmatched return; |
5 | Conditional return; |
6 | Conditional return; |
7 | Clone fragment #1 returns variables identity , while Clone fragment #2 returns variables |