while (it.hasNext()) { IContactModelPartial contactModel = it.next(); IContactItem item = createContactItem(contactModel); v.add(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 getAllContacts(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 contactModel = it.next();
2
					ISearchCriteria c = it2.next();
3
				IContactItem item = createContactItem(contactModel);
3
				
4
				v.add(item
4
	String searchCriteriaTechnicalName = c.getTechnicalName();
5
					// execute search
6
					doExecute(ref.getSearchTerm(), p,
7
							searchCriteriaTechnicalName, ref.isSearchInside(),
5
);
8
							ref.getStartIndex(), ref.getResultCount());
6
			}
9
				}
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 comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)10.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    13
    while (it.hasNext())
    13
    while (it.hasNext())
    15
    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
    15
    while (it2.hasNext())
    14
    IContactModelPartial contactModel = it.next();
    14
    IContactModelPartial contactModel = it.next();
    Preondition Violations
    Unmatched statement IContactModelPartial contactModel=it.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                    
    15
    IContactItem item = createContactItem(contactModel);
    15
    IContactItem item = createContactItem(contactModel);
    Preondition Violations
    Unmatched statement IContactItem item=createContactItem(contactModel); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                
                                                                      
    16
    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
    16
    ISearchCriteria c = it2.next();
    16
    v.add(item);
    16
    v.add(item);
    Preondition Violations
    Unmatched statement v.add(item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                    
                                                                                                                            
    17
    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
    17
    String searchCriteriaTechnicalName = c.getTechnicalName();
                                                                                                                                                                                                                                                                  
    18
    doExecute(ref.getSearchTerm(), p, searchCriteriaTechnicalName, ref.isSearchInside(), ref.getStartIndex(), ref.getResultCount());
    Preondition Violations
    Unmatched statement doExecute(ref.getSearchTerm(),p,searchCriteriaTechnicalName,ref.isSearchInside(),ref.getStartIndex(),ref.getResultCount()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    18
    doExecute(ref.getSearchTerm(), p, searchCriteriaTechnicalName, ref.isSearchInside(), ref.getStartIndex(), ref.getResultCount());
    Precondition Violations (8)
    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 IContactModelPartial contactModel=it.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement IContactItem item=createContactItem(contactModel); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched 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
    5Unmatched statement v.add(item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched 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
    7Unmatched statement doExecute(ref.getSearchTerm(),p,searchCriteriaTechnicalName,ref.isSearchInside(),ref.getStartIndex(),ref.getResultCount()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero