private void updateSearchDirectoriesConfiguration() { if (!disableConfigurationUpdate) { StringBuffer buf = new StringBuffer(); for (String s : searchDirectories) { buf.append(s).append(DIRECTORY_SEPARATOR); } Configuration.setString(KEY_DEFAULT_DIRECTORIES, buf.toString()); } }
private StringBuffer generateIncludes(StringBuffer sb) { for (Iterator it = systemInc.iterator(); it.hasNext(); ) { String inc = (String) it.next(); sb.append("#include <"); sb.append(inc).append('>').append(LINE_SEPARATOR); } // separate system from external headers if (systemInc.size() > 0) sb.append(LINE_SEPARATOR); for (Iterator it = extInc.iterator(); it.hasNext(); ) { String inc = (String) it.next(); sb.append("#include <"); sb.append(inc).append('>').append(LINE_SEPARATOR); } // separate external from local headers if (extInc.size() > 0) sb.append(LINE_SEPARATOR); for (Iterator it = localInc.iterator(); it.hasNext(); ) { String inc = (String) it.next(); sb.append("#include \"").append(inc).append("\"" + LINE_SEPARATOR); } return sb; }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java File path: /ArgoUML-0.34-src/argouml-cpp/src/org/argouml/language/cpp/generator/GeneratorCpp.java
Method name: void updateSearchDirectoriesConfiguration() Method name: StringBuffer generateIncludes(StringBuffer)
Number of AST nodes: 2 Number of AST nodes: 4
1
private void updateSearchDirectoriesConfiguration() {
1
private StringBuffer generateIncludes(StringBuffer sb) {
2
        if (!disableConfigurationUpdate) {
2
        for (Iterator it = systemInc.iterator(); it.hasNext(); ) {
3
            StringBuffer buf = new StringBuffer();
3
            String inc = (String) it.next();
4
            for (String s : searchDirectories) {
4
            sb.append("#include <");
5
                buf.append(s).append(DIRECTORY_SEPARATOR);
5
            sb.append(inc).append('>').append(LINE_SEPARATOR);
6
            }
6
        }
7
            Configuration.setString(KEY_DEFAULT_DIRECTORIES, buf.toString());
7
        // separate system from external headers
8
        }
8
        if (systemInc.size() > 0) sb.append(LINE_SEPARATOR);
9
    }
9
        for (Iterator it = extInc.iterator(); it.hasNext(); ) {
10
            String inc = (String) it.next();
11
            sb.append("#include <");
12
            sb.append(inc).append('>').append(LINE_SEPARATOR);
13
        }
14
        // separate external from local headers
15
        if (extInc.size() > 0) sb.append(LINE_SEPARATOR);
16
        for (Iterator it = localInc.iterator(); it.hasNext(); ) {
17
            String inc = (String) it.next();
18
            sb.append("#include \"").append(inc).append("\"" + LINE_SEPARATOR);
19
        }
20
        return sb;
21
    }
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.600
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    3
    for (String s : searchDirectories)
    3
    for (String s : searchDirectories)
    1
    for (Iterator it = systemInc.iterator(); it.hasNext(); )
    Differences
    Expression1Expression2Difference
    java.util.Listjava.util.SetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List<java.lang.String> of variable searchDirectories does not match with type java.util.Set of variable systemInc
    • Make classes java.util.List and java.util.Set extend a common superclass
    1
    for (Iterator it = systemInc.iterator(); it.hasNext(); )
                                                                    
    2
    String inc = (String)it.next();
    4
    buf.append(s).append(DIRECTORY_SEPARATOR);
    4
    buf.append(s).append(DIRECTORY_SEPARATOR);
    3
    sb.append("#include <");
    Differences
    Expression1Expression2Difference
    DIRECTORY_SEPARATOR"#include <"TYPE_COMPATIBLE_REPLACEMENT
    buf.append(s)sbTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression buf.append(s) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    sb.append("#include <");
                                                                                                              
    4
    sb.append(inc).append('>').append(LINE_SEPARATOR);
    Preondition Violations
    Unmatched statement sb.append(inc).append('>').append(LINE_SEPARATOR); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    sb.append(inc).append('>').append(LINE_SEPARATOR);
    Precondition Violations (4)
    Row Violation
    1Type java.util.List<java.lang.String> of variable searchDirectories does not match with type java.util.Set of variable systemInc
    2Expression buf.append(s) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement sb.append(inc).append('>').append(LINE_SEPARATOR); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Clone fragment #1 returns variables , while Clone fragment #2 returns variables inc