for (Iterator i = children.iterator(); i.hasNext();) { UnknownElement el = (UnknownElement) i.next(); el.maybeConfigure(); Child child = (Child) el.getRealThing(); child.injectParent(this); child.perform(); }
for( Iterator i = cleanUpList.iterator(); i.hasNext(); ) { File file = (File) i.next(); file.delete(); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/UnknownElementTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ssh/ScpTest.java
Method name: void execute() Method name: void tearDown()
Number of AST nodes: 6 Number of AST nodes: 3
1
for (Iterator i = children.iterator(); i.hasNext();) {
1
for( Iterator i = cleanUpList.iterator(); i.hasNext(); ) {
2
                UnknownElement el = (UnknownElement) i.next();
2
            
3
                el.maybeConfigure();
4
                Child child = (Child) el.getRealThing();
5
                child.injectParent(this);
6
                child.perform();
7
    
3
File file = (File) i.next();
4
            file.delete();
8
        }
5
        }
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 comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    for (Iterator i = children.iterator(); i.hasNext(); )
    1
    for (Iterator i = children.iterator(); i.hasNext(); )
    1
    for (Iterator i = cleanUpList.iterator(); i.hasNext(); )
    Differences
    Expression1Expression2Difference
    childrencleanUpListVARIABLE_NAME_MISMATCH
    1
    for (Iterator i = cleanUpList.iterator(); i.hasNext(); )
                                                            
    2
    File file = (File)i.next();
    Preondition Violations
    Unmatched statement File file=(File)i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    File file = (File)i.next();
    2
    UnknownElement el = (UnknownElement)i.next();
    2
    UnknownElement el = (UnknownElement)i.next();
    Preondition Violations
    Unmatched statement UnknownElement el=(UnknownElement)i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                
                                      
    3
    file.delete();
    Preondition Violations
    Unmatched statement file.delete(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    file.delete();
    3
    el.maybeConfigure();
    3
    el.maybeConfigure();
    Preondition Violations
    Unmatched statement el.maybeConfigure(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                  
    4
    Child child = (Child)el.getRealThing();
    4
    Child child = (Child)el.getRealThing();
    Preondition Violations
    Unmatched statement Child child=(Child)el.getRealThing(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                    
    5
    child.injectParent(this);
    5
    child.injectParent(this);
    Preondition Violations
    Unmatched statement child.injectParent(this); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                            
    6
    child.perform();
    6
    child.perform();
    Preondition Violations
    Unmatched statement child.perform(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                          
    Precondition Violations (7)
    Row Violation
    1Unmatched statement File file=(File)i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement UnknownElement el=(UnknownElement)i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement file.delete(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement el.maybeConfigure(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement Child child=(Child)el.getRealThing(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement child.injectParent(this); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement child.perform(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted