if (path != null) { treeNode = (AddressbookTreeNode) path.getLastPathComponent(); } // enable, if more than zero treenodes selected if ((path != null) && (treeNode instanceof AddressbookFolder)) { setEnabled(true); } else { setEnabled(false); }
if (path != null) { treeNode = (AddressbookTreeNode) path.getLastPathComponent(); } // enable, if more than zero treenodes selected if ((path != null) && (treeNode instanceof IGroupFolder)) { setEnabled(true); } else setEnabled(false);
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/action/AddContactCardAction.java File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/action/RemoveCardAction.java
Method name: void valueChanged(TreeSelectionEvent) Method name: void valueChanged(TreeSelectionEvent)
Number of AST nodes: 5 Number of AST nodes: 5
1
if (path != null) {
1
if (path != null) {
2
			treeNode = (AddressbookTreeNode) path.getLastPathComponent();
2
				treeNode = (AddressbookTreeNode) path.getLastPathComponent();
3
		}
3
			}
4
		// enable, if more than zero treenodes selected
4
			// enable, if more than zero treenodes selected
5
		if ((path != null) && (treeNode instanceof AddressbookFolder)) {
5
			if ((path != null) && (treeNode instanceof IGroupFolder)) {
6
			setEnabled(true);
6
				setEnabled(true);
7
		} else {
7
			} else
8
			setEnabled(false);
8
				setEnabled(false);
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.6
Clones locationClones are in different classes having the same super class
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    if (path != null)
    6
    if (path != null)
    3
    treeNode = (AddressbookTreeNode)path.getLastPathComponent();
    7
    treeNode = (AddressbookTreeNode)path.getLastPathComponent();
    4
    if ((path != null) && (treeNode instanceof AddressbookFolder))
    4
    if ((path != null) && (treeNode instanceof AddressbookFolder))
    8
    if ((path != null) && (treeNode instanceof IGroupFolder))
    Differences
    Expression1Expression2Difference
    org.columba.addressbook.folder.AddressbookFolderorg.columba.addressbook.folder.IGroupFolderVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression treeNode instanceof AddressbookFolder cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression treeNode instanceof IGroupFolder cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.columba.addressbook.folder.AddressbookFolder does not match with type org.columba.addressbook.folder.IGroupFolder
    • Make classes org.columba.addressbook.folder.AddressbookFolder and org.columba.addressbook.folder.IGroupFolder extend a common superclass
    8
    if ((path != null) && (treeNode instanceof IGroupFolder))
    5
    setEnabled(true);
    9
    setEnabled(true);
    else
    else
    6
    setEnabled(false);
    10
    setEnabled(false);
    Precondition Violations (3)
    Row Violation
    1Expression treeNode instanceof AddressbookFolder cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression treeNode instanceof IGroupFolder cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type org.columba.addressbook.folder.AddressbookFolder does not match with type org.columba.addressbook.folder.IGroupFolder