public void handleSettingsTabRefresh() { table.setModel(new ModuleTableModel()); StringBuffer sb = new StringBuffer(); List locations = ModuleLoader2.getInstance().getExtensionLocations(); for (Iterator it = locations.iterator(); it.hasNext();) { sb.append((String) it.next()); sb.append("\n"); } fieldAllExtDirs.setText(sb.substring(0, sb.length() - 1).toString()); }
@Override public String toString() { StringBuffer res = new StringBuffer(100); res.append(getClass().getName()).append(" {\n"); List<ToDoItem> itemList = getToDoItemList(); synchronized (itemList) { for (ToDoItem item : itemList) { res.append(" ").append(item.toString()).append("\n"); } } res.append(" }"); return res.toString(); }
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/moduleloader/SettingsTabModules.java File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/cognitive/ToDoList.java
Method name: void handleSettingsTabRefresh() Method name: String toString()
Number of AST nodes: 3 Number of AST nodes: 2
1
public void handleSettingsTabRefresh() {
1
@Override
2
        table.setModel(new ModuleTableModel());
2
    public String toString() {
3
        
3
        StringBuffer res = new StringBuffer(100);
4
        StringBuffer sb = new StringBuffer();
4
        res.append(getClass().getName()).append(" {\n");
5
        List locations = ModuleLoader2.getInstance().getExtensionLocations();
5
        List<ToDoItem> itemList = getToDoItemList();
6
        for (Iterator it = locations.iterator(); it.hasNext();) {
6
        synchronized (itemList) {
7
            sb.append((String) it.next());
7
            for (ToDoItem item : itemList) {
8
            sb.append("\n");
8
                res.append("    ").append(item.toString()).append("\n");
9
        }
9
            }
10
        fieldAllExtDirs.setText(sb.substring(0, sb.length() - 1).toString());
10
        }
11
    }
11
        res.append("  }");
12
        return res.toString();
13
    }
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.600
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    4
    for (Iterator it = locations.iterator(); it.hasNext(); )
    4
    for (Iterator it = locations.iterator(); it.hasNext(); )
    5
    for (ToDoItem item : itemList)
    Differences
    Expression1Expression2Difference
    java.util.Listjava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List of variable locations does not match with type java.util.List<org.argouml.cognitive.ToDoItem> of variable itemList
    • Make classes java.util.List and java.util.List extend a common superclass
    5
    for (ToDoItem item : itemList)
    5
    sb.append((String)it.next());
    5
    sb.append((String)it.next());
    Preondition Violations
    Unmatched statement sb.append((String)it.next()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                    
    6
    sb.append("\n");
    6
    sb.append("\n");
    6
    res.append(" ").append(item.toString()).append("\n");
    Differences
    Expression1Expression2Difference
    sbres.append(" ").append(item.toString())TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression res.append(" ").append(item.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    res.append("    ").append(item.toString()).append("\n");
    Precondition Violations (4)
    Row Violation
    1Type java.util.List of variable locations does not match with type java.util.List<org.argouml.cognitive.ToDoItem> of variable itemList
    2Unmatched statement sb.append((String)it.next()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Expression res.append(" ").append(item.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Clone fragment #1 returns variables it , while Clone fragment #2 returns variables