if (acceptDrop == true) { IBasicModelPartial[] items = HeaderItemDNDManager.getInstance() .getHeaderItemList(); for (int i = 0; i < items.length; i++) { ((AddressbookListModel) getModel()).removeElement(items[i]); } // removeElement(); }
if (acceptDrop == true) { IHeaderItem[] items = HeaderItemDNDManager.getInstance() .getHeaderItemList(); for (int i = 0; i < items.length; i++) { ((ContactListModel) getModel()).removeElement(items[i]); } // removeElement(); }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/list/AddressbookDNDListView.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/contact/list/ContactDNDListView.java
Method name: void dragDropEnd(DragSourceDropEvent) Method name: void dragDropEnd(DragSourceDropEvent)
Number of AST nodes: 4 Number of AST nodes: 4
1
if (acceptDrop == true) {
1
if (acceptDrop == true) {
2
				IBasicModelPartial[] items = HeaderItemDNDManager.getInstance()
2
				IHeaderItem[] items = HeaderItemDNDManager.getInstance()
3
						.getHeaderItemList();
3
						.getHeaderItemList();
4
				for (int i = 0; i < items.length; i++) {
4
				for (int i = 0; i < items.length; i++) {
5
					((AddressbookListModel) getModel()).removeElement(items[i]);
5
					((ContactListModel) getModel()).removeElement(items[i]);
6
				}
6
				}
7
				// removeElement();
7
				// removeElement();
8
			}
8
			}
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.3
Clones locationClones are in different classes having the same super class
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    if (acceptDrop == true)
    2
    if (acceptDrop == true)
                                                                                                                                                                
    3
    IHeaderItem[] items = HeaderItemDNDManager.getInstance().getHeaderItemList();
    Preondition Violations
    Unmatched statement IHeaderItem[] items=HeaderItemDNDManager.getInstance().getHeaderItemList(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    IHeaderItem[] items = HeaderItemDNDManager.getInstance().getHeaderItemList();
    3
    IBasicModelPartial[] items = HeaderItemDNDManager.getInstance().getHeaderItemList();
    3
    IBasicModelPartial[] items = HeaderItemDNDManager.getInstance().getHeaderItemList();
    Preondition Violations
    Unmatched statement IBasicModelPartial[] items=HeaderItemDNDManager.getInstance().getHeaderItemList(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                              
    4
    for (int i = 0; i < items.length; i++)
    4
    for (int i = 0; i < items.length; i++)
    4
    for (int i = 0; i < items.length; i++)
    Differences
    Expression1Expression2Difference
    org.columba.addressbook.model.IBasicModelPartial[]org.columba.addressbook.facade.IHeaderItem[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable items.length does not match with type int of variable items.length
    • Make classes org.columba.addressbook.model.IBasicModelPartial[] and org.columba.addressbook.facade.IHeaderItem[] extend a common superclass
    4
    for (int i = 0; i < items.length; i++)
    5
    ((AddressbookListModel)getModel()).removeElement(items[i]);
    5
    ((AddressbookListModel)getModel()).removeElement(items[i]);
    5
    ((ContactListModel)getModel()).removeElement(items[i]);
    Differences
    Expression1Expression2Difference
    org.columba.addressbook.model.IBasicModelPartial[]org.columba.addressbook.facade.IHeaderItem[]VARIABLE_TYPE_MISMATCH
    org.columba.addressbook.gui.list.AddressbookListModelorg.columba.mail.gui.contact.list.ContactListModelSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Type org.columba.addressbook.model.IBasicModelPartial[] of variable items does not match with type org.columba.addressbook.facade.IHeaderItem[] of variable items
    • Make classes org.columba.addressbook.model.IBasicModelPartial[] and org.columba.addressbook.facade.IHeaderItem[] extend a common superclass
    Expression (AddressbookListModel)getModel() cannot be unified with expression (ContactListModel)getModel() , because common superclass javax.swing.AbstractListModel does not declare member(s) public void removeElement(org.columba.addressbook.model.IBasicModelPartial) , public void removeElement(org.columba.addressbook.facade.IHeaderItem)
    5
    ((ContactListModel)getModel()).removeElement(items[i]);
    Precondition Violations (6)
    Row Violation
    1Unmatched statement IHeaderItem[] items=HeaderItemDNDManager.getInstance().getHeaderItemList(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement IBasicModelPartial[] items=HeaderItemDNDManager.getInstance().getHeaderItemList(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Type int of variable items.length does not match with type int of variable items.length
    4Type org.columba.addressbook.model.IBasicModelPartial[] of variable items does not match with type org.columba.addressbook.facade.IHeaderItem[] of variable items
    5Expression (AddressbookListModel)getModel() cannot be unified with expression (ContactListModel)getModel() , because common superclass javax.swing.AbstractListModel does not declare member(s) public void removeElement(org.columba.addressbook.model.IBasicModelPartial) , public void removeElement(org.columba.addressbook.facade.IHeaderItem)
    6The refactoring of the clones is infeasible, because classes org.columba.addressbook.gui.list.AddressbookDNDListView and org.columba.mail.gui.contact.list.ContactDNDListView do not have a common superclass