for (int i = 0; i < custom.count(); i++) { XmlElement child = custom.getElement(i); String name = child.getAttribute("id"); if (name.equals(id)) return new ViewItem(child); }
for (int i = 0; i < profiles.count(); i++) { XmlElement profile = profiles.getElement(i); String n = profile.getAttribute("name"); if (name.equalsIgnoreCase(n)) { return profile; } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/frame/FrameManager.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/profiles/ProfileManager.java
Method name: ViewItem createCustomViewItem(String) Method name: XmlElement getXmlElementForName(String)
Number of AST nodes: 5 Number of AST nodes: 5
1
for (int i = 0; i < custom.count(); i++) {
1
for (int i = 0; i < profiles.count(); i++) {
2
			XmlElement child = custom.getElement(i);
2
			XmlElement profile = profiles.getElement(i);
3
			String name = child.getAttribute("id");
3
			String n = profile.getAttribute("name");
4
			if (name.equals(id))
4
			if (name.equals
5
				return new ViewItem(child);
5
IgnoreCase(n)) {
6
				return profile;
7
			}
6
		}
8
		}
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 comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    5
    for (int i = 0; i < custom.count(); i++)
    5
    for (int i = 0; i < custom.count(); i++)
    1
    for (int i = 0; i < profiles.count(); i++)
    Differences
    Expression1Expression2Difference
    customprofilesVARIABLE_NAME_MISMATCH
    1
    for (int i = 0; i < profiles.count(); i++)
    6
    XmlElement child = custom.getElement(i);
    6
    XmlElement child = custom.getElement(i);
    2
    XmlElement profile = profiles.getElement(i);
    Differences
    Expression1Expression2Difference
    childprofileVARIABLE_NAME_MISMATCH
    customprofilesVARIABLE_NAME_MISMATCH
    2
    XmlElement profile = profiles.getElement(i);
    7
    String name = child.getAttribute("id");
    7
    String name = child.getAttribute("id");
    3
    String n = profile.getAttribute("name");
    Differences
    Expression1Expression2Difference
    namenVARIABLE_NAME_MISMATCH
    "id""name"LITERAL_VALUE_MISMATCH
    childprofileVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression name cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression n cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    String n = profile.getAttribute("name");
    8
    if (name.equals(id))
    8
    if (name.equals(id))
    4
    if (name.equalsIgnoreCase(n))
    Differences
    Expression1Expression2Difference
    equalsequalsIgnoreCaseMETHOD_INVOCATION_NAME_MISMATCH
    idnVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression name.equals(id) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression name.equalsIgnoreCase(n) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression n cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    if (name.equalsIgnoreCase(n))
                                        
    5
    return profile;
    Preondition Violations
    Unmatched statement return profile; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return profile;
    5
    return profile;
    9
    return new ViewItem(child);
    9
    return new ViewItem(child);
    Preondition Violations
    Unmatched statement return new ViewItem(child); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return new ViewItem(child);
                                                                
    Precondition Violations (9)
    Row Violation
    1Expression name cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression n cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression name.equals(id) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression name.equalsIgnoreCase(n) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression n cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Unmatched statement return profile; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched return profile;
    8Unmatched statement return new ViewItem(child); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched return new ViewItem(child);