for (int i = 0; i < attributeList.size(); i++) { Attribute feature = (Attribute) attributeList.elementAt(i); setFeature(feature.getName(), feature.getValue()); }
for (int i = 0; i < propertyList.size(); i++) { final Property prop = (Property) propertyList.elementAt(i); setProperty(prop.getName(), prop.getValue()); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
Method name: void initValidator() Method name: void initValidator()
Number of AST nodes: 3 Number of AST nodes: 3
1
for (int i = 0; i < attributeList.size(); i++) {
1
for (int i = 0; i < propertyList.size(); i++) {
2
                Attribute feature = (Attribute) attributeList.elementAt(i);
2
                final Property prop = (Property) propertyList.elementAt(i);
3
                setFeature(feature.getName(), feature.getValue());
3
                setProperty(prop.getName(), prop.getValue());
4
            }
4
            }
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 the same method
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    7
    for (int i = 0; i < attributeList.size(); i++)
    7
    for (int i = 0; i < attributeList.size(); i++)
    10
    for (int i = 0; i < propertyList.size(); i++)
    Differences
    Expression1Expression2Difference
    attributeListpropertyListVARIABLE_NAME_MISMATCH
    10
    for (int i = 0; i < propertyList.size(); i++)
    8
    Attribute feature = (Attribute)attributeList.elementAt(i);
    8
    Attribute feature = (Attribute)attributeList.elementAt(i);
    Preondition Violations
    Unmatched statement Attribute feature=(Attribute)attributeList.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                          
    9
    setFeature(feature.getName(), feature.getValue());
                                                                                                            
                                                                                                                            
    11
    final Property prop = (Property)propertyList.elementAt(i);
    Preondition Violations
    Unmatched statement final Property prop=(Property)propertyList.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11
    final Property prop = (Property)propertyList.elementAt(i);
                                                                                                    
    12
    setProperty(prop.getName(), prop.getValue());
    Precondition Violations (2)
    Row Violation
    1Unmatched statement Attribute feature=(Attribute)attributeList.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement final Property prop=(Property)propertyList.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted