if (telephoneComboBox.getSelectedIndex() == 13) destModel.addPhone(new PhoneModel(telephoneTextField.getText(), PhoneModel.TYPE_PRIMARY_PHONE)); else if (telephoneComboBox.getSelectedIndex() == 14) destModel.addPhone(new PhoneModel(telephoneTextField.getText(), PhoneModel.TYPE_RADIO)); else if (telephoneComboBox.getSelectedIndex() == 15) destModel.addPhone(new PhoneModel(telephoneTextField.getText(), PhoneModel.TYPE_TELEX)); else if (telephoneComboBox.getSelectedIndex() == 16) destModel.addPhone(new PhoneModel(telephoneTextField.getText(), PhoneModel.TYPE_TTY));
if (imComboBox.getSelectedIndex() == 1) destModel.addInstantMessaging(new InstantMessagingModel( imTextField.getText(), InstantMessagingModel.TYPE_AIM)); else if (imComboBox.getSelectedIndex() == 2) destModel .addInstantMessaging(new InstantMessagingModel( imTextField.getText(), InstantMessagingModel.TYPE_YAHOO)); else if (imComboBox.getSelectedIndex() == 3) destModel.addInstantMessaging(new InstantMessagingModel( imTextField.getText(), InstantMessagingModel.TYPE_MSN)); else if (imComboBox.getSelectedIndex() == 4) destModel.addInstantMessaging(new InstantMessagingModel( imTextField.getText(), InstantMessagingModel.TYPE_ICQ));
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/dialog/contact/ContactEditorDialog.java File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/dialog/contact/ContactEditorDialog.java
Method name: void fillPhoneModel(JTextField, JComboBox, ContactModel) Method name: void fillIMModel(JTextField, JComboBox, ContactModel)
Number of AST nodes: 8 Number of AST nodes: 8
1
if (telephoneComboBox.getSelectedIndex() == 13)
1
if (imComboBox.getSelectedIndex() == 1)
2
				destModel.addPhone(new PhoneModel(telephone
2
				destModel.addInstantMessaging(new InstantMessagingModel(
3
TextField.getText(),
3
						imTextField.getText(),
4
						PhoneModel.TYPE_PRIMARY_PHONE));
4
 InstantMessagingModel.TYPE_AIM));
5
			else if (telephoneComboBox.getSelectedIndex() == 14)
5
			else if (imComboBox.getSelectedIndex() == 2)
6
				destModel.addPhone(new PhoneModel(telephone
6
				destModel
7
						.addInstantMessaging(new InstantMessagingModel(
7
TextField.getText(),
8
								imTextField.getText(),
8
						PhoneModel.TYPE_RADIO));
9
								InstantMessagingModel.TYPE_YAHOO));
9
			else if (telephoneComboBox.getSelectedIndex() == 15)
10
			else if (imComboBox.getSelectedIndex() == 3)
10
				destModel.addPhone(new PhoneModel(telephone
11
				destModel.addInstantMessaging(new InstantMessagingModel(
11
TextField.getText(),
12
						imTextField.getText(),
12
						PhoneModel.TYPE_TELEX));
13
 InstantMessagingModel.TYPE_MSN));
13
			else if (telephoneComboBox.getSelectedIndex() == 16)
14
			else if (imComboBox.getSelectedIndex() == 4)
14
				destModel.addPhone(new PhoneModel(telephone
15
				destModel.addInstantMessaging(new InstantMessagingModel(
15
TextField.getText(),
16
						imTextField.getText(),
16
						PhoneModel.TYPE_TTY));
17
 InstantMessagingModel.TYPE_ICQ));
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)1.6
Clones locationClones are declared in the same class
Number of node comparisons47
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)9.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    28
    else if (telephoneComboBox.getSelectedIndex() == 13)
    28
    else if (telephoneComboBox.getSelectedIndex() == 13)
    4
    else if (imComboBox.getSelectedIndex() == 1)
    Differences
    Expression1Expression2Difference
    telephoneComboBoximComboBoxVARIABLE_NAME_MISMATCH
    131LITERAL_VALUE_MISMATCH
    4
    else if (imComboBox.getSelectedIndex() == 1)
                                                                                                                                                                                                                                        
    5
    destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(), InstantMessagingModel.TYPE_AIM));
    Preondition Violations
    Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_AIM)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_AIM)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    5
    destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(), InstantMessagingModel.TYPE_AIM));
    29
    destModel.addPhone(new PhoneModel(telephoneTextField.getText(), PhoneModel.TYPE_PRIMARY_PHONE));
    29
    destModel.addPhone(new PhoneModel(telephoneTextField.getText(), PhoneModel.TYPE_PRIMARY_PHONE));
    Preondition Violations
    Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_PRIMARY_PHONE)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_PRIMARY_PHONE)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                                                                                                          
    30
    else if (telephoneComboBox.getSelectedIndex() == 14)
    30
    else if (telephoneComboBox.getSelectedIndex() == 14)
    6
    else if (imComboBox.getSelectedIndex() == 2)
    Differences
    Expression1Expression2Difference
    telephoneComboBoximComboBoxVARIABLE_NAME_MISMATCH
    142LITERAL_VALUE_MISMATCH
    6
    else if (imComboBox.getSelectedIndex() == 2)
                                                                                                                                                                                                                                            
    7
    destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(), InstantMessagingModel.TYPE_YAHOO));
    Preondition Violations
    Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_YAHOO)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_YAHOO)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    7
    destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(), InstantMessagingModel.TYPE_YAHOO));
    31
    destModel.addPhone(new PhoneModel(telephoneTextField.getText(), PhoneModel.TYPE_RADIO));
    31
    destModel.addPhone(new PhoneModel(telephoneTextField.getText(), PhoneModel.TYPE_RADIO));
    Preondition Violations
    Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_RADIO)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_RADIO)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                                                                                          
    32
    else if (telephoneComboBox.getSelectedIndex() == 15)
    32
    else if (telephoneComboBox.getSelectedIndex() == 15)
    8
    else if (imComboBox.getSelectedIndex() == 3)
    Differences
    Expression1Expression2Difference
    telephoneComboBoximComboBoxVARIABLE_NAME_MISMATCH
    153LITERAL_VALUE_MISMATCH
    8
    else if (imComboBox.getSelectedIndex() == 3)
                                                                                                                                                                                                                                        
    9
    destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(), InstantMessagingModel.TYPE_MSN));
    Preondition Violations
    Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_MSN)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_MSN)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    9
    destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(), InstantMessagingModel.TYPE_MSN));
    33
    destModel.addPhone(new PhoneModel(telephoneTextField.getText(), PhoneModel.TYPE_TELEX));
    33
    destModel.addPhone(new PhoneModel(telephoneTextField.getText(), PhoneModel.TYPE_TELEX));
    Preondition Violations
    Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_TELEX)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_TELEX)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                                                                                          
    34
    else if (telephoneComboBox.getSelectedIndex() == 16)
    34
    else if (telephoneComboBox.getSelectedIndex() == 16)
    10
    else if (imComboBox.getSelectedIndex() == 4)
    Differences
    Expression1Expression2Difference
    telephoneComboBoximComboBoxVARIABLE_NAME_MISMATCH
    164LITERAL_VALUE_MISMATCH
    10
    else if (imComboBox.getSelectedIndex() == 4)
                                                                                                                                                                                                                                          
    11
    destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(), InstantMessagingModel.TYPE_ICQ));
    Preondition Violations
    Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_ICQ)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_ICQ)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    11
    destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(), InstantMessagingModel.TYPE_ICQ));
    35
    destModel.addPhone(new PhoneModel(telephoneTextField.getText(), PhoneModel.TYPE_TTY));
    35
    destModel.addPhone(new PhoneModel(telephoneTextField.getText(), PhoneModel.TYPE_TTY));
    Preondition Violations
    Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_TTY)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_TTY)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                                                                                      
    Precondition Violations (16)
    Row Violation
    1Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_AIM)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_AIM)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    3Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_PRIMARY_PHONE)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_PRIMARY_PHONE)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    5Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_YAHOO)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_YAHOO)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    7Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_RADIO)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_RADIO)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    9Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_MSN)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_MSN)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    11Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_TELEX)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    12Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_TELEX)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    13Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_ICQ)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    14Unmatched statement destModel.addInstantMessaging(new InstantMessagingModel(imTextField.getText(),InstantMessagingModel.TYPE_ICQ)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    15Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_TTY)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    16Unmatched statement destModel.addPhone(new PhoneModel(telephoneTextField.getText(),PhoneModel.TYPE_TTY)); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted