if (inheritRefs) { for (e = thisReferences.keys(); e.hasMoreElements();) { String key = (String) e.nextElement(); if (newReferences.containsKey(key)) { continue; } copyReference(key, key); newProject.inheritIDReferences(getProject()); } }
for (Iterator r = nextRC(rcIter).iterator(); r.hasNext();) { Object o = r.next(); if (asString) { o = o.toString(); } if (!(union.contains(o))) { union.add(o); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Ant.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/Union.java
Method name: void addReferences() Method name: Collection getCollection(boolean)
Number of AST nodes: 7 Number of AST nodes: 6
1
if (inheritRefs) {
2
            for (e = thisReferences.keys(); e.hasMoreElements();) {
1
for (Iterator r = nextRC(rcIter).iterator(); r.hasNext();) {
3
                String key = (String) e.nextElement();
2
                
4
                if (newReferences.containsKey(key)
3
Object o = r.next();
5
) {
4
                if (asString) {
6
                    continue;
5
                    o = o.toString();
7
                }
6
                }
8
                copyReference(key, key);
7
                
9
                newProject.inheritIDReferences(getProject()
8
if (!(union.contains(o))) {
10
);
9
                    union.add(o);
11
            }
10
            
11
    }
12
        }
12
            }
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.1
Clones locationClones are in different classes having the same super class
Number of node comparisons7
  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.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                              
    7
    Object o = r.next();
    20
    String key = (String)e.nextElement();
    20
    String key = (String)e.nextElement();
    Preondition Violations
    Unmatched statement String key=(String)e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                  
    21
    if (newReferences.containsKey(key))
    21
    if (newReferences.containsKey(key))
    8
    if (asString)
    Differences
    Expression1Expression2Difference
    newReferences.containsKey(key)asStringTYPE_COMPATIBLE_REPLACEMENT
    8
    if (asString)
                                        
    9
    o = o.toString();
    22
    continue;
    22
    continue;
    Preondition Violations
    Unmatched continue;
                              
    Precondition Violations (2)
    Row Violation
    1Unmatched statement String key=(String)e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched continue;