for (int i = 0; i < parent.count(); i++) { XmlElement child = parent.getElement(i); if (child.getAttribute("name").equals(name)) { return child; } } return null;
for (int i = 0; i < parent.getChildCount(); i++) { DefaultMutableTreeNode child = (DefaultMutableTreeNode) parent .getChildAt(i); if (group.equals(child.getUserObject())) return child; } return null;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/config/columns/ColumnConfigDialog.java File path: /columba-1.4-src/plugins/org.columba.chat.altura/src/org/columba/chat/command/PopulateRoasterCommand.java
Method name: XmlElement findColumn(XmlElement, String) Method name: DefaultMutableTreeNode findGroup(DefaultMutableTreeNode, RosterGroup)
Number of AST nodes: 5 Number of AST nodes: 5
1
for (int i = 0; i < parent.count(); i++) {
1
for (int i = 0; i < parent.getChildCount(); i++) {
2
			XmlElement child = parent.getElemen
2
			DefaultMutableTreeNode child = (DefaultMutableTreeNode) parent
3
t(i);
3
					.getChildAt(i);
4
			if (child.getAttribute("name").equals(name)) {
4
			if (group.equals(child.getUserObject()))
5
				return child;
5
				return child;
6
			}
7
		}
6
		}
8
		return null;
7
		return null;
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
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)8.1
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    for (int i = 0; i < parent.count(); i++)
    1
    for (int i = 0; i < parent.count(); i++)
    1
    for (int i = 0; i < parent.getChildCount(); i++)
    Differences
    Expression1Expression2Difference
    countgetChildCountMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.core.xml.XmlElementjavax.swing.tree.DefaultMutableTreeNodeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.columba.core.xml.XmlElement of variable parent does not match with type javax.swing.tree.DefaultMutableTreeNode of variable parent
    • Make classes org.columba.core.xml.XmlElement and javax.swing.tree.DefaultMutableTreeNode extend a common superclass
    1
    for (int i = 0; i < parent.getChildCount(); i++)
                                                                                                                                                              
    2
    DefaultMutableTreeNode child = (DefaultMutableTreeNode)parent.getChildAt(i);
    Preondition Violations
    Unmatched statement DefaultMutableTreeNode child=(DefaultMutableTreeNode)parent.getChildAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    DefaultMutableTreeNode child = (DefaultMutableTreeNode)parent.getChildAt(i);
    2
    XmlElement child = parent.getElement(i);
    2
    XmlElement child = parent.getElement(i);
    Preondition Violations
    Unmatched statement XmlElement child=parent.getElement(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                      
                                                                                        
    3
    if (group.equals(child.getUserObject()))
                                    
    4
    return child;
    Preondition Violations
    Unmatched return child;
    4
    return child;
    3
    if (child.getAttribute("name").equals(name))
                                                                                                
    4
    return child;
    4
    return child;
    Preondition Violations
    Unmatched return child;
                                    
    5
    return null;
    5
    return null;
    Precondition Violations (6)
    Row Violation
    1Type org.columba.core.xml.XmlElement of variable parent does not match with type javax.swing.tree.DefaultMutableTreeNode of variable parent
    2Unmatched statement DefaultMutableTreeNode child=(DefaultMutableTreeNode)parent.getChildAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement XmlElement child=parent.getElement(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return child;
    5Unmatched return child;
    6The refactoring of the clones is infeasible, because classes org.columba.mail.gui.config.columns.ColumnConfigDialog and org.columba.chat.command.PopulateRoasterCommand do not have a common superclass