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 statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)103.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    30
    while (it.hasNext())
    36
    while (it.hasNext())
    31
    model.addEmail((IEmailModel)it.next());
    31
    model.addEmail((IEmailModel)it.next());
    37
    model.addInstantMessaging((InstantMessagingModel)it.next());
    Differences
    Expression1Expression2Difference
    addEmailaddInstantMessagingMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.addressbook.model.IEmailModelorg.columba.addressbook.model.InstantMessagingModelVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression model.addEmail((IEmailModel)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.addEmail((IEmailModel)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
    Expression (IEmailModel)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.IEmailModel of variable (IEmailModel)it.next() does not match with type org.columba.addressbook.model.InstantMessagingModel of variable (InstantMessagingModel)it.next()
    • Make classes org.columba.addressbook.model.IEmailModel and org.columba.addressbook.model.InstantMessagingModel extend a common superclass
    37
    model.addInstantMessaging((InstantMessagingModel)it.next());
    32
    it = parser.getPhoneIterator();
    32
    it = parser.getPhoneIterator();
    35
    it = parser.getInstantMessagingIterator();
    Differences
    Expression1Expression2Difference
    getPhoneIteratorgetInstantMessagingIteratorMETHOD_INVOCATION_NAME_MISMATCH
    35
    it = parser.getInstantMessagingIterator();
                                                                          
    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();
    33
    while (it.hasNext())
    39
    while (it.hasNext())
    34
    model.addPhone((PhoneModel)it.next());
    34
    model.addPhone((PhoneModel)it.next());
    40
    model.addAddress((AddressModel)it.next());
    Differences
    Expression1Expression2Difference
    addPhoneaddAddressMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.addressbook.model.PhoneModelorg.columba.addressbook.model.AddressModelVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression model.addPhone((PhoneModel)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.addPhone((PhoneModel)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
    Expression (PhoneModel)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.PhoneModel of variable (PhoneModel)it.next() does not match with type org.columba.addressbook.model.AddressModel of variable (AddressModel)it.next()
    • Make classes org.columba.addressbook.model.PhoneModel and org.columba.addressbook.model.AddressModel extend a common superclass
    40
    model.addAddress((AddressModel)it.next());
    Precondition Violations (15)
    Row Violation
    1Expression model.addEmail((IEmailModel)it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression model.addInstantMessaging((InstantMessagingModel)it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression model.addEmail((IEmailModel)it.next()) is a void method call, and thus it cannot be parameterized
    4Expression model.addInstantMessaging((InstantMessagingModel)it.next()) is a void method call, and thus it cannot be parameterized
    5Expression (IEmailModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression (InstantMessagingModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Type org.columba.addressbook.model.IEmailModel of variable (IEmailModel)it.next() does not match with type org.columba.addressbook.model.InstantMessagingModel of variable (InstantMessagingModel)it.next()
    8Unmatched statement it=parser.getAddressIterator(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Expression model.addPhone((PhoneModel)it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression model.addAddress((AddressModel)it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression model.addPhone((PhoneModel)it.next()) is a void method call, and thus it cannot be parameterized
    12Expression model.addAddress((AddressModel)it.next()) is a void method call, and thus it cannot be parameterized
    13Expression (PhoneModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression (AddressModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Type org.columba.addressbook.model.PhoneModel of variable (PhoneModel)it.next() does not match with type org.columba.addressbook.model.AddressModel of variable (AddressModel)it.next()