for (int i = 0; i < parent.count(); i++) { XmlElement child = parent.getElement(i); if (child.getAttribute("name").equals(name)) { return child; } }
for (int i = 0; i < root.count(); i++) { XmlElement child = root.getElement(i); if (child.getAttribute("name").equals(id)) { return child; } }
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/core/src/main/java/org/columba/core/gui/externaltools/ExternalToolsManager.java
Method name: XmlElement findColumn(XmlElement, String) Method name: XmlElement getConfiguration(String)
Number of AST nodes: 4 Number of AST nodes: 4
1
for (int i = 0; i < parent.count(); i++) {
1
for (int i = 0; i < root.count(); i++) {
2
			XmlElement child = parent.getElement(i);
2
			XmlElement child = root.getElement(i);
3
			if (child.getAttribute("name").equals(name)) {
3
			if (child.getAttribute("name").equals(id)) {
4
				return child;
4
				return child;
5
			}
5
			}
6
		}
6
		}
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
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    for (int i = 0; i < parent.count(); i++)
    1
    for (int i = 0; i < parent.count(); i++)
    2
    for (int i = 0; i < root.count(); i++)
    Differences
    Expression1Expression2Difference
    parentrootVARIABLE_NAME_MISMATCH
    2
    for (int i = 0; i < root.count(); i++)
    2
    XmlElement child = parent.getElement(i);
    2
    XmlElement child = parent.getElement(i);
    3
    XmlElement child = root.getElement(i);
    Differences
    Expression1Expression2Difference
    parentrootVARIABLE_NAME_MISMATCH
    3
    XmlElement child = root.getElement(i);
    3
    if (child.getAttribute("name").equals(name))
    3
    if (child.getAttribute("name").equals(name))
    4
    if (child.getAttribute("name").equals(id))
    Differences
    Expression1Expression2Difference
    nameidVARIABLE_NAME_MISMATCH
    4
    if (child.getAttribute("name").equals(id))
    4
    return child;
    5
    return child;
    Precondition Violations (1)
    Row Violation
    1Not all possible execution flows end in a return statement