public TreeNodeList(String[] str) { for (int i = 0; i < str.length; i++) { list.add(str[i]); } }
public TreeNodeList(String s) { list = new Vector(); StringTokenizer tok = new StringTokenizer(s, "/"); while (tok.hasMoreTokens()) { String next = tok.nextToken(); list.add(next); } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/tree/util/TreeNodeList.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/tree/util/TreeNodeList.java
Method name: void TreeNodeList(String[]) Method name: void TreeNodeList(String)
Number of AST nodes: 2 Number of AST nodes: 3
1
public TreeNodeList(String[] str) {
1
public TreeNodeList(String s) {
2
        for (int i = 0; i < str.length; i++) {
2
        list = new Vector();
3
            list.add(str[i]);
3
4
        }
4
        StringTokenizer tok = new StringTokenizer(s, "/");
5
    }
5
6
        while (tok.hasMoreTokens()) {
7
            String next = tok.nextToken();
8
9
            list.add(next);
10
        }
11
    }
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    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.500
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    for (int i = 0; i < str.length; i++)
    1
    for (int i = 0; i < str.length; i++)
    3
    while (tok.hasMoreTokens())
    Differences
    Expression1Expression2Difference
    i < str.lengthtok.hasMoreTokens()TYPE_COMPATIBLE_REPLACEMENT
    java.lang.String[]java.lang.StringVARIABLE_TYPE_MISMATCH
    java.lang.String[]java.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String[] of variable str does not match with type java.lang.String of variable s
    • Make classes java.lang.String[] and java.lang.String extend a common superclass
    Type java.lang.String[] of variable str does not match with type java.lang.String of variable s
    • Make classes java.lang.String[] and java.lang.String extend a common superclass
    3
    while (tok.hasMoreTokens())
                                                                  
    4
    String next = tok.nextToken();
    2
    list.add(str[i]);
    2
    list.add(str[i]);
    5
    list.add(next);
    Differences
    Expression1Expression2Difference
    str[i]nextTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression str[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    list.add(next);
    Precondition Violations (3)
    Row Violation
    1Type java.lang.String[] of variable str does not match with type java.lang.String of variable s
    2Type java.lang.String[] of variable str does not match with type java.lang.String of variable s
    3Expression str[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted