/** * Returns a string representation of the object for error messages * and the like * @return a string representation of the object. */ public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(namespace != null ? namespace : "(anonymous)"); buffer.append(' '); buffer.append(url != null ? (url + " ") : ""); buffer.append(file != null ? file.getAbsolutePath() : ""); return buffer.toString(); }
/** * @return a string describing this object */ public String 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/taskdefs/optional/SchemaValidate.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: 1 Number of AST nodes: 3
1
/**
1
/**
2
         * Returns a string representation of the object for error messages
2
     * @return a string describing this object
3
         * and the like
3
     */
4
         * @return a string representation of the object.
4
    public String toString() {
5
         */
5
        StringBuffer buf = new StringBuffer("{presentselector targetdir: ");
6
        public String toString() {
6
        if (targetdir == null) {
7
            StringBuffer buffer = new StringBuffer();
7
            buf.append("NOT YET SET");
8
            buffer.append(namespace != null ? namespace : "(anonymous)");
8
        } else {
9
            buffer.append(' ');
9
            buf.append(targetdir.getName());
10
            buffer.append(url != null ? (url + " ") : "");
10
        }
11
            buffer.append(file != null ? file.getAbsolutePath() : "");
11
        buf.append(" present: ");
12
            return buffer.toString();
12
        if (destmustexist) {
13
        }
13
            buf.append("both");
14
        } else {
15
            buf.append("srconly");
16
        }
17
        if (map != null) {
18
            buf.append(map.toString());
19
        } else if (mapperElement != null) {
20
            buf.append(mapperElement.toString());
21
        }
22
        buf.append("}");
23
        return buf.toString();
24
    }
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements3
    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.0
    Similarity Score0.600
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    buffer.append(namespace != null ? namespace : "(anonymous)");
    2
    buffer.append(namespace != null ? namespace : "(anonymous)");
    6
    if (destmustexist)
    Differences
    Expression1Expression2Difference
    namespace != nulldestmustexistTYPE_COMPATIBLE_REPLACEMENT
    bufferbufVARIABLE_NAME_MISMATCH
    bufferbufVARIABLE_NAME_MISMATCH
    namespace"both"TYPE_COMPATIBLE_REPLACEMENT
    "(anonymous)""srconly"LITERAL_VALUE_MISMATCH
    6
    if (destmustexist)
                                                
    7
    buf.append("both");
    Differences
    Expression1Expression2Difference
    bufferbufVARIABLE_NAME_MISMATCH
    namespace"both"TYPE_COMPATIBLE_REPLACEMENT
    7
    buf.append("both");
            
    else
                                                      
    8
    buf.append("srconly");
    Differences
    Expression1Expression2Difference
    bufferbufVARIABLE_NAME_MISMATCH
    "(anonymous)""srconly"LITERAL_VALUE_MISMATCH
    8
    buf.append("srconly");
    Precondition Violations (0)
    Row Violation