StringBuffer buf = new StringBuffer("{dependselector targetdir: "); if (targetdir == null) { buf.append("NOT YET SET"); } else { buf.append(targetdir.getName()); } buf.append(" granularity: "); buf.append(granularity); if (map != null) { buf.append(" mapper: "); buf.append(map.toString()); } else if (mapperElement != null) { buf.append(" mapper: "); buf.append(mapperElement.toString()); } buf.append("}"); return buf.toString();
StringBuffer buf = new StringBuffer("{presentselector targetdir: "); if (targetdir == null) { buf.append("NOT YET SET"); } else { buf.append(targetdir.getName()); } buf.append(" present: "); if (destmustexist) { buf.append("both"); } else { buf.append("srconly"); } if (map != null) { buf.append(map.toString()); } else if (mapperElement != null) { buf.append(mapperElement.toString()); } buf.append("}"); return buf.toString();
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/DependSelector.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/PresentSelector.java
Method name: String toString() Method name: String toString()
Number of AST nodes: 14 Number of AST nodes: 14
1
StringBuffer buf = new StringBuffer("{dependselector targetdir: ");
1
StringBuffer buf = new StringBuffer("{presentselector targetdir: ");
2
        if (targetdir == null) {
2
        if (targetdir == null) {
3
            buf.append("NOT YET SET");
3
            buf.append("NOT YET SET");
4
        } else {
4
        } else {
5
            buf.append(targetdir.getName());
5
            buf.append(targetdir.getName());
6
        }
6
        }
7
        buf.append(" granularity: ");
7
        buf.append(" present: ");
8
        buf.append(granularity);
8
        
9
        if (map != null) {
10
            buf.append(" mapper: ");
9
if (destmustexist) {
10
            buf.append("both");
11
        } else {
12
            buf.append("srconly");
13
        }
14
        if (map != null) {
11
            buf.append(map.toString());
15
            buf.append(map.toString());
12
        } else if (mapperElement != null) {
16
        } else if (mapperElement != null) {
13
            buf.append(" mapper: ");
14
            buf.append(mapperElement.toString());
17
            buf.append(mapperElement.toString());
15
        }
18
        }
16
        buf.append("}");
19
        buf.append("}");
17
        return buf.toString();
20
        return buf.toString();
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.9
Clones locationClones are in different classes having the same super class
Number of node comparisons59
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)5.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    StringBuffer buf = new StringBuffer("{dependselector targetdir: ");
    1
    StringBuffer buf = new StringBuffer("{dependselector targetdir: ");
    1
    StringBuffer buf = new StringBuffer("{presentselector targetdir: ");
    Differences
    Expression1Expression2Difference
    "{dependselector targetdir: ""{presentselector targetdir: "LITERAL_VALUE_MISMATCH
    1
    StringBuffer buf = new StringBuffer("{presentselector targetdir: ");
    2
    if (targetdir == null)
    2
    if (targetdir == null)
    3
    buf.append("NOT YET SET");
    3
    buf.append("NOT YET SET");
    else
    else
    4
    buf.append(targetdir.getName());
    4
    buf.append(targetdir.getName());
    5
    buf.append(" granularity: ");
    5
    buf.append(" granularity: ");
    5
    buf.append(" present: ");
    Differences
    Expression1Expression2Difference
    " granularity: "" present: "LITERAL_VALUE_MISMATCH
    5
    buf.append(" present: ");
                                            
    6
    if (destmustexist)
                                                
    7
    buf.append("both");
    Preondition Violations
    Unmatched statement buf.append("both"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    buf.append("both");
            
    else
                                                      
    8
    buf.append("srconly");
    Preondition Violations
    Unmatched statement buf.append("srconly"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    buf.append("srconly");
    6
    buf.append(granularity);
    6
    buf.append(granularity);
    Preondition Violations
    Unmatched statement buf.append(granularity); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                          
    7
    if (map != null)
    9
    if (map != null)
    8
    buf.append(" mapper: ");
    8
    buf.append(" mapper: ");
    Preondition Violations
    Unmatched statement buf.append(" mapper: "); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                          
    9
    buf.append(map.toString());
    10
    buf.append(map.toString());
    10
    else if (mapperElement != null)
    11
    else if (mapperElement != null)
    11
    buf.append(" mapper: ");
    11
    buf.append(" mapper: ");
    Preondition Violations
    Unmatched statement buf.append(" mapper: "); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                            
    12
    buf.append(mapperElement.toString());
    12
    buf.append(mapperElement.toString());
    13
    buf.append("}");
    13
    buf.append("}");
    14
    return buf.toString();
    14
    return buf.toString();
    Precondition Violations (5)
    Row Violation
    1Unmatched statement buf.append("both"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement buf.append("srconly"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement buf.append(granularity); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement buf.append(" mapper: "); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement buf.append(" mapper: "); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted