while (it.hasNext()) { IContactModelPartial partial = it.next(); IContactItem item = createContactItem(partial); groupItem.addContact(item); }
while (it2.hasNext()) { ISearchCriteria c = it2.next(); String searchCriteriaTechnicalName = c .getTechnicalName(); // execute search doExecute(ref.getSearchTerm(), p, searchCriteriaTechnicalName, ref .isSearchInside(), ref.getStartIndex(), ref.getResultCount()); }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/facade/ContactFacade.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/search/SearchManager.java
Method name: List getAllGroups(String) Method name: void execute(IWorkerStatusController)
Number of AST nodes: 4 Number of AST nodes: 4
1
while (it.hasNext()) {
1
while (it2.hasNext()) {
2
				IContactModelPartial partial = it.next();
2
						ISearchCriteria c = it2.next();
3
				IContactItem item = createContactItem(partial);
3
				
4
				groupItem.add
4
		String searchCriteriaTechnicalName = c
5
								.getTechnicalName();
6
						// execute search
7
						doExecute(ref.getSearchTerm(), p,
8
								searchCriteriaTechnicalName, ref
9
										.isSearchInside(), ref.getStartIndex(),
5
Contact(item);
10
								ref.getResultCount());
6
			}
11
					}
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)0.1
Clones locationClones are in different classes
Number of node comparisons19
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)12.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    20
    while (it.hasNext())
    20
    while (it.hasNext())
    7
    while (it2.hasNext())
    Differences
    Expression1Expression2Difference
    itit2VARIABLE_NAME_MISMATCH
    java.util.Iteratorjava.util.IteratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Iterator<org.columba.addressbook.model.IContactModelPartial> of variable it does not match with type java.util.Iterator<org.columba.core.search.api.ISearchCriteria> of variable it2
    • Make classes java.util.Iterator and java.util.Iterator extend a common superclass
    7
    while (it2.hasNext())
                                                                    
    8
    ISearchCriteria c = it2.next();
    Preondition Violations
    Unmatched statement ISearchCriteria c=it2.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    ISearchCriteria c = it2.next();
                                                                                                                          
    9
    String searchCriteriaTechnicalName = c.getTechnicalName();
    Preondition Violations
    Unmatched statement String searchCriteriaTechnicalName=c.getTechnicalName(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9
    String searchCriteriaTechnicalName = c.getTechnicalName();
    21
    IContactModelPartial partial = it.next();
    21
    IContactModelPartial partial = it.next();
    Preondition Violations
    Unmatched statement IContactModelPartial partial=it.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                          
    22
    IContactItem item = createContactItem(partial);
    22
    IContactItem item = createContactItem(partial);
    Preondition Violations
    Unmatched statement IContactItem item=createContactItem(partial); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                      
    23
    groupItem.addContact(item);
    23
    groupItem.addContact(item);
    10
    doExecute(ref.getSearchTerm(), p, searchCriteriaTechnicalName, ref.isSearchInside(), ref.getStartIndex(), ref.getResultCount());
    Differences
    Expression1Expression2Difference
    addContactdoExecuteMETHOD_INVOCATION_NAME_MISMATCH
    groupItem.addContact(item)doExecute(ref.getSearchTerm(),p,searchCriteriaTechnicalName,ref.isSearchInside(),ref.getStartIndex(),ref.getResultCount())ARGUMENT_NUMBER_MISMATCH
    groupItemMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression groupItem.addContact(item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression doExecute(ref.getSearchTerm(),p,searchCriteriaTechnicalName,ref.isSearchInside(),ref.getStartIndex(),ref.getResultCount()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method doExecute
    Expression groupItem.addContact(item) is a void method call, and thus it cannot be parameterized
    Expression doExecute(ref.getSearchTerm(),p,searchCriteriaTechnicalName,ref.isSearchInside(),ref.getStartIndex(),ref.getResultCount()) is a void method call, and thus it cannot be parameterized
    Expression groupItem.addContact(item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression doExecute(ref.getSearchTerm(),p,searchCriteriaTechnicalName,ref.isSearchInside(),ref.getStartIndex(),ref.getResultCount()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method doExecute
    Expression groupItem.addContact(item) is a void method call, and thus it cannot be parameterized
    Expression doExecute(ref.getSearchTerm(),p,searchCriteriaTechnicalName,ref.isSearchInside(),ref.getStartIndex(),ref.getResultCount()) is a void method call, and thus it cannot be parameterized
    10
    doExecute(ref.getSearchTerm(), p, searchCriteriaTechnicalName, ref.isSearchInside(), ref.getStartIndex(), ref.getResultCount());
    Precondition Violations (13)
    Row Violation
    1Type java.util.Iterator<org.columba.addressbook.model.IContactModelPartial> of variable it does not match with type java.util.Iterator<org.columba.core.search.api.ISearchCriteria> of variable it2
    2Unmatched statement ISearchCriteria c=it2.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement String searchCriteriaTechnicalName=c.getTechnicalName(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement IContactModelPartial partial=it.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement IContactItem item=createContactItem(partial); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Expression groupItem.addContact(item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression doExecute(ref.getSearchTerm(),p,searchCriteriaTechnicalName,ref.isSearchInside(),ref.getStartIndex(),ref.getResultCount()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression groupItem.addContact(item) is a void method call, and thus it cannot be parameterized
    9Expression doExecute(ref.getSearchTerm(),p,searchCriteriaTechnicalName,ref.isSearchInside(),ref.getStartIndex(),ref.getResultCount()) is a void method call, and thus it cannot be parameterized
    10Expression groupItem.addContact(item) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression doExecute(ref.getSearchTerm(),p,searchCriteriaTechnicalName,ref.isSearchInside(),ref.getStartIndex(),ref.getResultCount()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression groupItem.addContact(item) is a void method call, and thus it cannot be parameterized
    13Expression doExecute(ref.getSearchTerm(),p,searchCriteriaTechnicalName,ref.isSearchInside(),ref.getStartIndex(),ref.getResultCount()) is a void method call, and thus it cannot be parameterized