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.8 |
Clones location | Clones are in different classes |
Number of node comparisons | 71 |
Number of mapped statements | 12 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 25.8 |
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) |
| 11 | if (emailAddress == null && displayname == null) | ||||||||||||||||||
7 | return; |
| 12 | 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) |
| 14 | if (emailAddress != null) | ||||||||||||||||||
11 | return; |
| | |||||||||||||||||||
|
| 15 | temp = searchProvider.query(emailAddress, ContactSearchProvider.CRITERIA_EMAIL_CONTAINS, false, 0, 5); | |||||||||||||||||||
|
| 16 | result.addAll(temp); | |||||||||||||||||||
12 | List<ISearchResult> temp; | 13 | List<ISearchResult> temp; | |||||||||||||||||||
13 | if (emailAddress != null) |
| 17 | if (displayname != null) | ||||||||||||||||||
14 | temp = searchProvider.query(emailAddress, ContactSearchProvider.CRITERIA_EMAIL_CONTAINS, false, 0, 5); |
| 18 | temp = searchProvider.query(displayname, ContactSearchProvider.CRITERIA_DISPLAYNAME_CONTAINS, false, 0, 5); | ||||||||||||||||||
15 | result.addAll(temp); | 19 | result.addAll(temp); |
Row | Violation |
---|---|
1 | Expression value cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression identity cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Conditional return; |
4 | Conditional return; |
5 | Unmatched statement Iterator<IStructureValue> it=value.getChildIterator(ISemanticContext.CONTEXT_NODE_IDENTITY,ISemanticContext.CONTEXT_NAMESPACE_CORE); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
6 | Expression identity == null cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression emailAddress == null && displayname == null cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Conditional return; |
9 | Conditional return; |
10 | Expression emailAddress == null && displayname == null cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression emailAddress != null cannot be parameterized, because it has dependencies to/from statements that will be extracted |
12 | Unmatched return; |
13 | Unmatched statement temp=searchProvider.query(emailAddress,ContactSearchProvider.CRITERIA_EMAIL_CONTAINS,false,0,5); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
14 | Unmatched statement temp=searchProvider.query(emailAddress,ContactSearchProvider.CRITERIA_EMAIL_CONTAINS,false,0,5); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
15 | Unmatched statement result.addAll(temp); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
16 | Expression emailAddress cannot be parameterized, because it has dependencies to/from statements that will be extracted |
17 | Expression displayname cannot be parameterized, because it has dependencies to/from statements that will be extracted |
18 | Expression emailAddress cannot be parameterized, because it has dependencies to/from statements that will be extracted |
19 | Expression displayname cannot be parameterized, because it has dependencies to/from statements that will be extracted |
20 | Clone fragment #1 returns variables displayname, temp , while Clone fragment #2 returns variables |