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;
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;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/contact/gui/box/ContactList.java File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/search/SearchResultList.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
			IContactModelPartial result = (IContactModelPartial) value;
8
			ISearchResult result = (ISearchResult) value;
9
			titleLabel.setText(result.getName());
9
			titleLabel.setText(result.getTitle());
10
			iconLabel.setIcon(ImageLoader.getSmallIcon(IconKeys.USER));
10
			iconLabel.setIcon(ImageLoader.getSmallIcon(IconKeys.USER));
11
			descriptionLabel.setText(result.getAddress());
11
			descriptionLabel.setText(result.getDescription());
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.2
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)11.2
    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
    ISearchResult result = (ISearchResult)value;
    6
    IContactModelPartial result = (IContactModelPartial)value;
                                                                                                                          
    7
    titleLabel.setText(result.getName());
    7
    titleLabel.setText(result.getName());
    7
    titleLabel.setText(result.getTitle());
    Differences
    Expression1Expression2Difference
    getNamegetTitleMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.addressbook.model.IContactModelPartialorg.columba.core.search.api.ISearchResultVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression result.getName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression result.getTitle() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.columba.addressbook.model.IContactModelPartial of variable result does not match with type org.columba.core.search.api.ISearchResult of variable result
    • Make classes org.columba.addressbook.model.IContactModelPartial and org.columba.core.search.api.ISearchResult extend a common superclass
    7
    titleLabel.setText(result.getTitle());
    8
    iconLabel.setIcon(ImageLoader.getSmallIcon(IconKeys.USER));
    8
    iconLabel.setIcon(ImageLoader.getSmallIcon(IconKeys.USER));
    9
    descriptionLabel.setText(result.getAddress());
    9
    descriptionLabel.setText(result.getAddress());
    9
    descriptionLabel.setText(result.getDescription());
    Differences
    Expression1Expression2Difference
    getAddressgetDescriptionMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.addressbook.model.IContactModelPartialorg.columba.core.search.api.ISearchResultVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression result.getAddress() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression result.getDescription() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.columba.addressbook.model.IContactModelPartial of variable result does not match with type org.columba.core.search.api.ISearchResult of variable result
    • Make classes org.columba.addressbook.model.IContactModelPartial and org.columba.core.search.api.ISearchResult extend a common superclass
    9
    descriptionLabel.setText(result.getDescription());
    10
    return this;
    10
    return this;
    Precondition Violations (6)
    Row Violation
    1Expression result.getName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression result.getTitle() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type org.columba.addressbook.model.IContactModelPartial of variable result does not match with type org.columba.core.search.api.ISearchResult of variable result
    4Expression result.getAddress() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression result.getDescription() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type org.columba.addressbook.model.IContactModelPartial of variable result does not match with type org.columba.core.search.api.ISearchResult of variable result