for (int i = 0; i < parent.getChildCount(); i++) { IMailFolder child = (IMailFolder) parent.getChildAt(i); CheckableTreeNode c = new CheckableTreeNode(child.getName()); c.setIcon(FolderTreeCellRenderer.getFolderIcon(child, false)); c.setNode(child); root.add(c); createChildNodes(c, child); }
for (int i = 0; i < items.length; i++) { String item = (String) items[i]; // all headerfields are lowercase in property file String i18n = MailResourceLoader.getString("header", item .toLowerCase()); headerMenuItem = new JRadioButtonMenuItem(i18n); headerMenuItem.setActionCommand(item); headerMenuItem.addActionListener(this); columnGroup.add(headerMenuItem); add(headerMenuItem); }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/config/export/ExportDialog.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/table/action/SortMessagesMenu.java
Method name: void createChildNodes(CheckableTreeNode, IMailFolder) Method name: void createSubMenu()
Number of AST nodes: 7 Number of AST nodes: 8
1
for (int i = 0; i < parent.getChildCount(); i++) {
1
for (int i = 0; i < 
2
			IMailFolder child = (IMailFolder) parent.getChildAt(i);
3
			CheckableTreeNode c = new CheckableTreeNode(child.getNam
2
items.length; i++) {
3
			String item = (String) items[i];
4
			// all headerfields are lowercase in property file
5
			String i18n = MailResourceLoader.getString("header", item
4
e());
6
					.toLowerCase());
5
			c.setIcon(FolderTreeCellRenderer.getFolderIcon(child, false));
7
			
6
			c.setNode(child);
7
			root.add(c
8
headerMenuItem = new JRadioButtonMenuItem(i18n);
9
			headerMenuItem.setActionCommand(item);
10
			headerMenuItem.addActionListener(this);
8
);
11
			columnGroup.add(headerMenuItem);
9
			createChildNodes(c, child);
12
			add(headerMenuItem);
10
		}
13
		}
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.1
Clones locationClones are in different classes having the same super class
Number of node comparisons56
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)2.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    for (int i = 0; i < parent.getChildCount(); i++)
    1
    for (int i = 0; i < parent.getChildCount(); i++)
    13
    for (int i = 0; i < items.length; i++)
    Differences
    Expression1Expression2Difference
    parent.getChildCount()items.lengthTYPE_COMPATIBLE_REPLACEMENT
    13
    for (int i = 0; i < items.length; i++)
    2
    IMailFolder child = (IMailFolder)parent.getChildAt(i);
    2
    IMailFolder child = (IMailFolder)parent.getChildAt(i);
    Preondition Violations
    Unmatched statement IMailFolder child=(IMailFolder)parent.getChildAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                  
    3
    CheckableTreeNode c = new CheckableTreeNode(child.getName());
    3
    CheckableTreeNode c = new CheckableTreeNode(child.getName());
    Preondition Violations
    Unmatched statement CheckableTreeNode c=new CheckableTreeNode(child.getName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                
    4
    c.setIcon(FolderTreeCellRenderer.getFolderIcon(child, false));
                                                                                                                                    
    5
    c.setNode(child);
    5
    c.setNode(child);
    Preondition Violations
    Unmatched statement c.setNode(child); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                            
                                                                      
    14
    String item = (String)items[i];
    Preondition Violations
    Unmatched statement String item=(String)items[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14
    String item = (String)items[i];
                                                                                                                                                        
    15
    String i18n = MailResourceLoader.getString("header", item.toLowerCase());
    Preondition Violations
    Unmatched statement String i18n=MailResourceLoader.getString("header",item.toLowerCase()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    15
    String i18n = MailResourceLoader.getString("header", item.toLowerCase());
                                                                                                        
    16
    headerMenuItem = new JRadioButtonMenuItem(i18n);
    Preondition Violations
    Unmatched statement headerMenuItem=new JRadioButtonMenuItem(i18n); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    16
    headerMenuItem = new JRadioButtonMenuItem(i18n);
                                                                                          
    18
    headerMenuItem.addActionListener(this);
    Preondition Violations
    Unmatched statement headerMenuItem.addActionListener(this); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    18
    headerMenuItem.addActionListener(this);
    6
    root.add(c);
    6
    root.add(c);
    19
    columnGroup.add(headerMenuItem);
    Differences
    Expression1Expression2Difference
    cheaderMenuItemVARIABLE_NAME_MISMATCH
    org.columba.mail.gui.config.export.CheckableTreeNodejavax.swing.JRadioButtonMenuItemVARIABLE_TYPE_MISMATCH
    rootcolumnGroupVARIABLE_NAME_MISMATCH
    org.columba.mail.gui.config.export.CheckableTreeNodejavax.swing.ButtonGroupVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.columba.mail.gui.config.export.CheckableTreeNode of variable c does not match with type javax.swing.JRadioButtonMenuItem of variable headerMenuItem
    • Make classes org.columba.mail.gui.config.export.CheckableTreeNode and javax.swing.JRadioButtonMenuItem extend a common superclass
    Type org.columba.mail.gui.config.export.CheckableTreeNode of variable root does not match with type javax.swing.ButtonGroup of variable columnGroup
    • Make classes org.columba.mail.gui.config.export.CheckableTreeNode and javax.swing.ButtonGroup extend a common superclass
    19
    columnGroup.add(headerMenuItem);
    7
    createChildNodes(c, child);
    7
    createChildNodes(c, child);
    17
    headerMenuItem.setActionCommand(item);
    Differences
    Expression1Expression2Difference
    createChildNodessetActionCommandMETHOD_INVOCATION_NAME_MISMATCH
    createChildNodes(c,child)headerMenuItem.setActionCommand(item)ARGUMENT_NUMBER_MISMATCH
    headerMenuItemMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression createChildNodes(c,child) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method createChildNodes
    Expression createChildNodes(c,child) is a void method call, and thus it cannot be parameterized
    Expression headerMenuItem.setActionCommand(item) is a void method call, and thus it cannot be parameterized
    Expression createChildNodes(c,child) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method createChildNodes
    Expression createChildNodes(c,child) is a void method call, and thus it cannot be parameterized
    Expression headerMenuItem.setActionCommand(item) is a void method call, and thus it cannot be parameterized
    17
    headerMenuItem.setActionCommand(item);
                                                    
    20
    add(headerMenuItem);
    Precondition Violations (15)
    Row Violation
    1Unmatched statement IMailFolder child=(IMailFolder)parent.getChildAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement CheckableTreeNode c=new CheckableTreeNode(child.getName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement c.setNode(child); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement String item=(String)items[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement String i18n=MailResourceLoader.getString("header",item.toLowerCase()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement headerMenuItem=new JRadioButtonMenuItem(i18n); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement headerMenuItem.addActionListener(this); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Type org.columba.mail.gui.config.export.CheckableTreeNode of variable c does not match with type javax.swing.JRadioButtonMenuItem of variable headerMenuItem
    9Type org.columba.mail.gui.config.export.CheckableTreeNode of variable root does not match with type javax.swing.ButtonGroup of variable columnGroup
    10Expression createChildNodes(c,child) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression createChildNodes(c,child) is a void method call, and thus it cannot be parameterized
    12Expression headerMenuItem.setActionCommand(item) is a void method call, and thus it cannot be parameterized
    13Expression createChildNodes(c,child) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression createChildNodes(c,child) is a void method call, and thus it cannot be parameterized
    15Expression headerMenuItem.setActionCommand(item) is a void method call, and thus it cannot be parameterized