if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } ISearchResult result = (ISearchResult) value; titleLabel.setText(result.getTitle()); iconLabel.setIcon(ImageLoader.getSmallIcon(IconKeys.USER)); descriptionLabel.setText(result.getDescription()); return this;
if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } IContactModelPartial result = (IContactModelPartial) value; titleLabel.setText(result.getName()); iconLabel.setIcon(ImageLoader.getSmallIcon(IconKeys.USER)); descriptionLabel.setText(result.getAddress()); return this;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/search/SearchResultList.java File path: /columba-1.4-src/contact/src/main/java/org/columba/contact/gui/box/ContactList.java
Method name: Component getListCellRendererComponent(JList, Object, int, boolean, boolean) Method name: Component getListCellRendererComponent(JList, Object, int, boolean, boolean)
Number of AST nodes: 10 Number of AST nodes: 10
1
if (isSelected) {
1
if (isSelected) {
2
				 setBackground(list.getSelectionBackground());
2
				setBackground(list.getSelectionBackground());
3
				 setForeground(list.getSelectionForeground());
3
				setForeground(list.getSelectionForeground());
4
			} else {
4
			} else {
5
				setBackground(list.getBackground());
5
				setBackground(list.getBackground());
6
				setForeground(list.getForeground());
6
				setForeground(list.getForeground());
7
			}
7
			}
8
			ISearchResult result = (ISearchResult) value;
8
			IContactModelPartial result = (IContactModelPartial) value;
9
			titleLabel.setText(result.getTitle());
9
			titleLabel.setText(result.getName());
10
			iconLabel.setIcon(ImageLoader.getSmallIcon(IconKeys.USER));
10
			iconLabel.setIcon(ImageLoader.getSmallIcon(IconKeys.USER));
11
			descriptionLabel.setText(result.getDescription());
11
			descriptionLabel.setText(result.getAddress());
12
			return this;
12
			return this;
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 having the same super class
Number of node comparisons50
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)3.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (isSelected)
    1
    if (isSelected)
    2
    setBackground(list.getSelectionBackground());
    2
    setBackground(list.getSelectionBackground());
    3
    setForeground(list.getSelectionForeground());
    3
    setForeground(list.getSelectionForeground());
    else
    else
    4
    setBackground(list.getBackground());
    4
    setBackground(list.getBackground());
    5
    setForeground(list.getForeground());
    5
    setForeground(list.getForeground());
                                                                                                                          
    6
    IContactModelPartial result = (IContactModelPartial)value;
    6
    ISearchResult result = (ISearchResult)value;
                                                                                              
    7
    titleLabel.setText(result.getTitle());
    7
    titleLabel.setText(result.getTitle());
    7
    titleLabel.setText(result.getName());
    Differences
    Expression1Expression2Difference
    getTitlegetNameMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.core.search.api.ISearchResultorg.columba.addressbook.model.IContactModelPartialVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.columba.core.search.api.ISearchResult of variable result does not match with type org.columba.addressbook.model.IContactModelPartial of variable result
    • Make classes org.columba.core.search.api.ISearchResult and org.columba.addressbook.model.IContactModelPartial extend a common superclass
    7
    titleLabel.setText(result.getName());
    8
    iconLabel.setIcon(ImageLoader.getSmallIcon(IconKeys.USER));
    8
    iconLabel.setIcon(ImageLoader.getSmallIcon(IconKeys.USER));
    9
    descriptionLabel.setText(result.getDescription());
    9
    descriptionLabel.setText(result.getDescription());
    9
    descriptionLabel.setText(result.getAddress());
    Differences
    Expression1Expression2Difference
    getDescriptiongetAddressMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.core.search.api.ISearchResultorg.columba.addressbook.model.IContactModelPartialVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.columba.core.search.api.ISearchResult of variable result does not match with type org.columba.addressbook.model.IContactModelPartial of variable result
    • Make classes org.columba.core.search.api.ISearchResult and org.columba.addressbook.model.IContactModelPartial extend a common superclass
    9
    descriptionLabel.setText(result.getAddress());
    10
    return this;
    10
    return this;
    Precondition Violations (2)
    Row Violation
    1Type org.columba.core.search.api.ISearchResult of variable result does not match with type org.columba.addressbook.model.IContactModelPartial of variable result
    2Type org.columba.core.search.api.ISearchResult of variable result does not match with type org.columba.addressbook.model.IContactModelPartial of variable result