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()); }
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()); }
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: 9 Number of AST nodes: 8
1
while (it.hasNext()) {
2
			model.addEmail((IEmailModel) it.next());
3
		}
1
it = parser.getPhoneIterator();
4
		it = parser.getPhoneIterator();
2
		while (it.hasNext()) {
5
		while (it.hasNext()) {
3
			model.addPhone((PhoneModel) it.next());
6
			model.addPhone((PhoneModel) it.next());
4
		}
7
		}
5
		it = parser.getInstantMessagingIterator();
8
		it = parser.getInstantMessagingIterator();
6
		while (it.hasNext()) {
9
		while (it.hasNext()) {
7
			model.addInstantMessaging((InstantMessagingModel) it.next());
10
			model.addInstantMessaging((InstantMessagingModel) it.next());
8
		}
11
		}
9
		it = parser.getAddressIterator();
10
		while (it.hasNext()) {
11
			model.addAddress((AddressModel) it.next());
12
		}
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.4
Clones locationClones are in the same method
Number of node comparisons36
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)198.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    32
    it = parser.getPhoneIterator();
    32
    it = parser.getPhoneIterator();
    33
    while (it.hasNext())
    33
    while (it.hasNext())
    34
    model.addPhone((PhoneModel)it.next());
    34
    model.addPhone((PhoneModel)it.next());
    35
    it = parser.getInstantMessagingIterator();
    35
    it = parser.getInstantMessagingIterator();
    36
    while (it.hasNext())
    36
    while (it.hasNext())
    37
    model.addInstantMessaging((InstantMessagingModel)it.next());
    37
    model.addInstantMessaging((InstantMessagingModel)it.next());
    38
    it = parser.getAddressIterator();
    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
                                                                          
    39
    while (it.hasNext())
    30
    while (it.hasNext())
    40
    model.addAddress((AddressModel)it.next());
    40
    model.addAddress((AddressModel)it.next());
    31
    model.addEmail((IEmailModel)it.next());
    Differences
    Expression1Expression2Difference
    addAddressaddEmailMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.addressbook.model.AddressModelorg.columba.addressbook.model.IEmailModelVARIABLE_TYPE_MISMATCH
    Preondition Violations
    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()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression model.addAddress((AddressModel)it.next()) is a void method call, and thus it cannot be parameterized
    Expression model.addEmail((IEmailModel)it.next()) is a void method call, and thus it cannot be parameterized
    Expression (AddressModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (IEmailModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.columba.addressbook.model.AddressModel of variable (AddressModel)it.next() does not match with type org.columba.addressbook.model.IEmailModel of variable (IEmailModel)it.next()
    • Make classes org.columba.addressbook.model.AddressModel and org.columba.addressbook.model.IEmailModel extend a common superclass
    31
    model.addEmail((IEmailModel)it.next());
    Precondition Violations (8)
    Row Violation
    1Unmatched statement it=parser.getAddressIterator(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression model.addAddress((AddressModel)it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression model.addEmail((IEmailModel)it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression model.addAddress((AddressModel)it.next()) is a void method call, and thus it cannot be parameterized
    5Expression model.addEmail((IEmailModel)it.next()) is a void method call, and thus it cannot be parameterized
    6Expression (AddressModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression (IEmailModel)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Type org.columba.addressbook.model.AddressModel of variable (AddressModel)it.next() does not match with type org.columba.addressbook.model.IEmailModel of variable (IEmailModel)it.next()