if (obj == this) { return true; } if (!(obj instanceof Directory)) { return false; } Directory d = (Directory) obj; return this.directory.equals(d.directory);
if (obj == this) { return true; } if (obj == null || !obj.getClass().equals(getClass())) { return false; } TemplateElement t = (TemplateElement) obj; return (name == null ? t.name == null : name.equals(t.name)) && optional == t.optional && implicit == t.implicit;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/ssh/Directory.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/MacroDef.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 6 Number of AST nodes: 6
1
if (obj == this) {
1
if (obj == this) {
2
            return true;
2
              return true;
3
        }
3
        
4
    }
4
        if (!(obj instanceof Directory)) {
5
            if (obj == null || !obj.getClass().equals(getClass())) {
5
            return false;
6
                return false;
6
        }
7
            }
7
        Directory d = (Directory) obj;
8
            TemplateElement t = (TemplateElement) obj;
8
        return this.directory.equals(d.directory)
9
            return
10
                (name == null ? t.name == null : name.equals(t.name))
11
                && optional == t.optional
9
;
12
                && implicit == t.implicit;
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.3
Clones locationClones are in different classes
Number of node comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.2
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj == this)
    1
    if (obj == this)
    2
    return true;
    2
    return true;
    2
    return true;
    Preondition Violations
    Conditional return true;
    Conditional return true;
    2
    return true;
    Precondition Violations (2)
    Row Violation
    1Conditional return true;
    2Conditional return true;