if (isReference() && getProject() != null) { return getRef(getProject()).hasPatterns(); } if (defaultPatterns.hasPatterns(getProject())) { return true; } Enumeration e = additionalPatterns.elements(); while (e.hasMoreElements()) { PatternSet ps = (PatternSet) e.nextElement(); if (ps.hasPatterns(getProject())) { return true; } } return false;
if (this == another) { return true; } if (isReference()) { return getCheckedRef().equals(another); } if (!(another.getClass().equals(getClass()))) { return false; } ArchiveResource r = (ArchiveResource) another; return getArchive().equals(r.getArchive()) && getName().equals(r.getName());
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/AbstractFileSet.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/ArchiveResource.java
Method name: boolean hasPatterns() Method name: boolean equals(Object)
Number of AST nodes: 10 Number of AST nodes: 8
1
if (isReference() && getProject() != null) {
1
if (
2
            return getRef(getProject()).hasPatterns();
3
        }
4
        if (defaultPatterns.hasPatterns(getProject())) {
5
            return true;
6
        }
7
        Enumeration e = additionalPatterns.elements();
8
        while (e.hasMoreElements()) {
9
            PatternSet ps = (PatternSet) e.nextElement()
2
this == another) {
3
            return true;
4
        }
5
        if (isReference()) {
6
            return getCheckedRef().equals(another);
7
        }
8
        if (!(another.getClass().equals(getClass()))) {
10
;
9
            return false;
11
        
10
        }
12
    if (ps.hasPatterns(getProject())) {
11
    
13
                return true;
14
            }
12
    ArchiveResource r = (ArchiveResource) another;
13
        return getArchive().equals(r.getArchive())
15
        }
14
        
16
        return false;
15
    && getName().equals(r.getName());
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 having the same super class
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    7
    PatternSet ps = (PatternSet)e.nextElement();
    7
    PatternSet ps = (PatternSet)e.nextElement();
    Preondition Violations
    Unmatched statement PatternSet ps=(PatternSet)e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                              
    8
    if (ps.hasPatterns(getProject()))
    8
    if (ps.hasPatterns(getProject()))
    5
    if (!(another.getClass().equals(getClass())))
    Differences
    Expression1Expression2Difference
    ps.hasPatterns(getProject())!(another.getClass().equals(getClass()))TYPE_COMPATIBLE_REPLACEMENT
    5
    if (!(another.getClass().equals(getClass())))
    9
    return true;
    9
    return true;
    6
    return false;
    Differences
    Expression1Expression2Difference
    truefalseLITERAL_VALUE_MISMATCH
    Preondition Violations
    Conditional return true;
    Conditional return false;
    6
    return false;
    Precondition Violations (3)
    Row Violation
    1Unmatched statement PatternSet ps=(PatternSet)e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Conditional return true;
    3Conditional return false;