while (it.hasNext()) { model.addEmail((IEmailModel) it.next()); } it = parser.getPhoneIterator(); while (it.hasNext()) { model.addPhone((PhoneModel) it.next()); }
it = parser.getInstantMessagingIterator(); while (it.hasNext()) { model.addInstantMessaging((InstantMessagingModel) it.next()); } it = parser.getAddressIterator(); while (it.hasNext()) { model.addAddress((AddressModel) it.next()); }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/model/ContactModelXMLFactory.java File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/model/ContactModelXMLFactory.java
Method name: IContactModel unmarshall(Document, String) Method name: IContactModel unmarshall(Document, String)
Number of AST nodes: 5 Number of AST nodes: 6
1
it = parser.getInstantMessagingIterator();
1
while (it.hasNext()) {
2
		while (it.hasNext()) {
2
			model.addEmail((IEmailModel) it.next());
3
			model.addInstantMessaging((InstantMessagingModel) it.next());
3
		}
4
		}
4
		it = parser.getPhoneIterator();
5
		it = parser.getAddressIterator();
5
		while (it.hasNext()) {
6
		while (it.hasNext()) {
6
			model.addPhone((PhoneModel) it.next());
7
			model.addAddress((AddressModel) it.next());
7
		}
8
		}
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.3
Clones locationClones are in the same method
Number of node comparisons19
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)318.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    30
    while (it.hasNext())
    39
    while (it.hasNext())
    31
    model.addEmail((IEmailModel)it.next());
    31
    model.addEmail((IEmailModel)it.next());
    40
    model.addAddress((AddressModel)it.next());
    Differences
    Expression1Expression2Difference
    org.columba.addressbook.model.IEmailModelorg.columba.addressbook.model.AddressModelVARIABLE_TYPE_MISMATCH
    addEmailaddAddressMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression (IEmailModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (AddressModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.columba.addressbook.model.IEmailModel does not match with type org.columba.addressbook.model.AddressModel
    • Make classes org.columba.addressbook.model.IEmailModel and org.columba.addressbook.model.AddressModel extend a common superclass
    Expression model.addEmail((IEmailModel)it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression model.addAddress((AddressModel)it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression model.addEmail((IEmailModel)it.next()) is a void method call, and thus it cannot be parameterized
    Expression model.addAddress((AddressModel)it.next()) is a void method call, and thus it cannot be parameterized
    40
    model.addAddress((AddressModel)it.next());
    32
    it = parser.getPhoneIterator();
    32
    it = parser.getPhoneIterator();
    Preondition Violations
    Unmatched statement it=parser.getPhoneIterator(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                      
                                                                                            
    35
    it = parser.getInstantMessagingIterator();
    33
    while (it.hasNext())
    36
    while (it.hasNext())
    34
    model.addPhone((PhoneModel)it.next());
    34
    model.addPhone((PhoneModel)it.next());
    37
    model.addInstantMessaging((InstantMessagingModel)it.next());
    Differences
    Expression1Expression2Difference
    org.columba.addressbook.model.PhoneModelorg.columba.addressbook.model.InstantMessagingModelVARIABLE_TYPE_MISMATCH
    addPhoneaddInstantMessagingMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression (PhoneModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (InstantMessagingModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.columba.addressbook.model.PhoneModel does not match with type org.columba.addressbook.model.InstantMessagingModel
    • Make classes org.columba.addressbook.model.PhoneModel and org.columba.addressbook.model.InstantMessagingModel extend a common superclass
    Expression model.addPhone((PhoneModel)it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression model.addInstantMessaging((InstantMessagingModel)it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression model.addPhone((PhoneModel)it.next()) is a void method call, and thus it cannot be parameterized
    Expression model.addInstantMessaging((InstantMessagingModel)it.next()) is a void method call, and thus it cannot be parameterized
    37
    model.addInstantMessaging((InstantMessagingModel)it.next());
                                                                          
    38
    it = parser.getAddressIterator();
    Preondition Violations
    Unmatched statement it=parser.getAddressIterator(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    38
    it = parser.getAddressIterator();
    Precondition Violations (16)
    Row Violation
    1Expression (IEmailModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression (AddressModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type org.columba.addressbook.model.IEmailModel does not match with type org.columba.addressbook.model.AddressModel
    4Expression model.addEmail((IEmailModel)it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression model.addAddress((AddressModel)it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression model.addEmail((IEmailModel)it.next()) is a void method call, and thus it cannot be parameterized
    7Expression model.addAddress((AddressModel)it.next()) is a void method call, and thus it cannot be parameterized
    8Unmatched statement it=parser.getPhoneIterator(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Expression (PhoneModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression (InstantMessagingModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Type org.columba.addressbook.model.PhoneModel does not match with type org.columba.addressbook.model.InstantMessagingModel
    12Expression model.addPhone((PhoneModel)it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression model.addInstantMessaging((InstantMessagingModel)it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression model.addPhone((PhoneModel)it.next()) is a void method call, and thus it cannot be parameterized
    15Expression model.addInstantMessaging((InstantMessagingModel)it.next()) is a void method call, and thus it cannot be parameterized
    16Unmatched statement it=parser.getAddressIterator(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted