IStructureValue identity = it.next(); if (identity == null) return; String emailAddress = identity.getString( ISemanticContext.CONTEXT_ATTR_EMAIL_ADDRESS, ISemanticContext.CONTEXT_NAMESPACE_CORE); String displayname = identity.getString( ISemanticContext.CONTEXT_ATTR_DISPLAY_NAME, ISemanticContext.CONTEXT_NAMESPACE_CORE); if (emailAddress == null && displayname == null) return; List<ISearchResult> temp; if (emailAddress != null) { temp = searchProvider.query(emailAddress, ContactSearchProvider.CRITERIA_EMAIL_CONTAINS, false, 0, 5); result.addAll(temp); } if (displayname != null) { temp = searchProvider.query(displayname, ContactSearchProvider.CRITERIA_DISPLAYNAME_CONTAINS, false, 0, 5); result.addAll(temp); }
IStructureValue identity = it.next(); if (identity == null) return; String emailAddress = identity.getString( ISemanticContext.CONTEXT_ATTR_EMAIL_ADDRESS, ISemanticContext.CONTEXT_NAMESPACE_CORE); String displayname = identity.getString( ISemanticContext.CONTEXT_ATTR_DISPLAY_NAME, ISemanticContext.CONTEXT_NAMESPACE_CORE); if (emailAddress == null && displayname == null) return; List<ISearchResult> temp; if (emailAddress != null) { temp = searchProvider.query(emailAddress, ContactSearchProvider.CRITERIA_EMAIL_CONTAINS, false, 0, 5); result.addAll(temp); } if (displayname != null) { temp = searchProvider.query(displayname, ContactSearchProvider.CRITERIA_DISPLAYNAME_CONTAINS, false, 0, 5); result.addAll(temp); }
Clone fragments detected by clone detection tool
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: 14 Number of AST nodes: 14
1
IStructureValue identity = it.next();
1
IStructureValue identity = it.next();
2
		if (identity == null)
2
			if (identity == null)
3
			return;
3
				return;
4
		String emailAddress = identity.getString(
4
			String emailAddress = identity.getString(
5
				ISemanticContext.CONTEXT_ATTR_EMAIL_ADDRESS,
5
					ISemanticContext.CONTEXT_ATTR_EMAIL_ADDRESS,
6
				ISemanticContext.CONTEXT_NAMESPACE_CORE);
6
					ISemanticContext.CONTEXT_NAMESPACE_CORE);
7
		String displayname = identity.getString(
7
			String displayname = identity.getString(
8
				ISemanticContext.CONTEXT_ATTR_DISPLAY_NAME,
8
					ISemanticContext.CONTEXT_ATTR_DISPLAY_NAME,
9
				ISemanticContext.CONTEXT_NAMESPACE_CORE);
9
					ISemanticContext.CONTEXT_NAMESPACE_CORE);
10
		if (emailAddress == null && displayname == null)
10
			if (emailAddress == null && displayname == null)
11
			return;
11
				return;
12
		List<ISearchResult> temp;
12
			List<ISearchResult> temp;
13
		if (emailAddress != null) {
13
			if (emailAddress != null) {
14
			temp = searchProvider.query(emailAddress,
14
				temp = searchProvider.query(emailAddress,
15
					ContactSearchProvider.CRITERIA_EMAIL_CONTAINS, false, 
15
						ContactSearchProvider.CRITERIA_EMAIL_CONTAINS, false,
16
0, 5);
16
						0, 5);
17
			result.addAll(temp);
17
				result.addAll(temp);
18
		}
18
			}
19
		if (displayname != null) {
19
			if (displayname != null) {
20
			temp = searchProvider.query(displayname,
20
				temp = searchProvider.query(displayname,
21
			ContactSearchProvider.CRITERIA_DISPLAYNAME_CONTAINS, 
21
						ContactSearchProvider.CRITERIA_DISPLAYNAME_CONTAINS,
22
false, 0, 5);
22
						false, 0, 5);
23
			result.addAll(temp);
23
				result.addAll(temp);
24
		}
24
			}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)1.2
Clones locationClones are in different classes
Number of node comparisons75
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)10.8
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    5
    IStructureValue identity = it.next();
    6
    IStructureValue identity = it.next();
    6
    if (identity == null)
    7
    if (identity == null)
    7
    return;
    7
    return;
    8
    return;
    Preondition Violations
    Conditional return;
    Conditional return;
    8
    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;
    11
    return;
    12
    return;
    Preondition Violations
    Conditional return;
    Conditional 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);
    Precondition Violations (4)
    Row Violation
    1Conditional return;
    2Conditional return;
    3Conditional return;
    4Conditional return;