if (this == another) { return true; } if (isReference()) { return getCheckedRef().equals(another); } if (!(another.getClass().equals(getClass()))) { return false; } FileResource otherfr = (FileResource) another; return getFile() == null ? otherfr.getFile() == null : getFile().equals(otherfr.getFile());
if (this == another) { return true; } if (isReference()) { return getCheckedRef().equals(another); } if (!(another.getClass().equals(getClass()))) { return false; } URLResource otheru = (URLResource) another; return getURL() == null ? otheru.getURL() == null : getURL().equals(otheru.getURL());
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/FileResource.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/URLResource.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 8 Number of AST nodes: 8
1
if (this == another) {
1
if (this == another) {
2
            return true;
2
            return true;
3
        }
3
        }
4
        if (isReference()) {
4
        if (isReference()) {
5
            return getCheckedRef().equals(another);
5
            return getCheckedRef().equals(another);
6
        }
6
        }
7
        if (!(another.getClass().equals(getClass()))) {
7
        if (!(another.getClass().equals(getClass()))) {
8
            return false;
8
            return false;
9
        }
9
        }
10
        FileResource otherfr = (FileResource) another;
10
        URLResource otheru = (URLResource) another;
11
        return getFile() == null
11
        return getURL() == null
12
            ? otherfr.getFile() == null
12
            ? otheru.getURL() == null
13
            : getFile().equals(otherfr.getFile());
13
            : getURL().equals(otheru.getURL());
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)1.1
Clones locationClones are in different classes having the same super class
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)3.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (this == another)
    1
    if (this == another)
    2
    return true;
    2
    return true;
    3
    if (isReference())
    3
    if (isReference())
    4
    return getCheckedRef().equals(another);
    4
    return getCheckedRef().equals(another);
    5
    if (!(another.getClass().equals(getClass())))
    5
    if (!(another.getClass().equals(getClass())))
    6
    return false;
    6
    return false;
    7
    FileResource otherfr = (FileResource)another;
    7
    FileResource otherfr = (FileResource)another;
    7
    URLResource otheru = (URLResource)another;
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.types.resources.FileResourceorg.apache.tools.ant.types.resources.URLResourceSUBCLASS_TYPE_MISMATCH
    otherfrotheruVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.types.resources.FileResourceorg.apache.tools.ant.types.resources.URLResourceSUBCLASS_TYPE_MISMATCH
    org.apache.tools.ant.types.resources.FileResourceorg.apache.tools.ant.types.resources.URLResourceSUBCLASS_TYPE_MISMATCH
    7
    URLResource otheru = (URLResource)another;
                                                                                                                                                                                    
    8
    return getURL() == null ? otheru.getURL() == null : getURL().equals(otheru.getURL());
    Preondition Violations
    Unmatched statement return getURL() == null ? otheru.getURL() == null : getURL().equals(otheru.getURL()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return getURL() == null ? otheru.getURL() == null : getURL().equals(otheru.getURL());
    8
    return getURL() == null ? otheru.getURL() == null : getURL().equals(otheru.getURL());
    8
    return getFile() == null ? otherfr.getFile() == null : getFile().equals(otherfr.getFile());
    8
    return getFile() == null ? otherfr.getFile() == null : getFile().equals(otherfr.getFile());
    Preondition Violations
    Unmatched statement return getFile() == null ? otherfr.getFile() == null : getFile().equals(otherfr.getFile()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return getFile() == null ? otherfr.getFile() == null : getFile().equals(otherfr.getFile());
                                                                                                                                                                                                
    Precondition Violations (5)
    Row Violation
    1Unmatched statement return getURL() == null ? otheru.getURL() == null : getURL().equals(otheru.getURL()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched return getURL() == null ? otheru.getURL() == null : getURL().equals(otheru.getURL());
    3Unmatched statement return getFile() == null ? otherfr.getFile() == null : getFile().equals(otherfr.getFile()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return getFile() == null ? otherfr.getFile() == null : getFile().equals(otherfr.getFile());
    5Not all possible execution flows end in a return statement