while ( iter.hasNext() ) { AuctionInfo ai = (AuctionInfo) iter.next(); System.out.println( "Auction: " + ai.getId() + " - " + ai.getDescription() + ", ends: " + ai.getEnds() + ", highest bid: " + ai.getMaxAmount() ); }
while ( iter.hasNext() ) { AuctionItem auction = (AuctionItem) iter.next(); System.out.println( "Auction: " + auction.getId() + " - " + auction.getDescription() + ", ends: " + auction.getEnds() + ", bids: " + auction.getBids() ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/tutorials/eg/src/main/java/org/hibernate/auction/Main.java File path: /hibernate-distribution-3.3.2.GA/project/tutorials/eg/src/main/java/org/hibernate/auction/Main.java
Method name: void viewAllAuctionsFast() Method name: void viewAllAuctionsSlow()
Number of AST nodes: 3 Number of AST nodes: 3
1
while ( iter.hasNext() ) {
1
while ( iter.hasNext() ) {
2
				AuctionInfo ai = (AuctionInfo) iter.next();
2
				AuctionItem auction = (AuctionItem) iter.next();
3
				System.out.println(
3
				System.out.println(
4
					"Auction: " + ai.getId() + " - " + ai.getDescription() +
4
					"Auction: " + auction.getId() + " - " + auction.getDescription() +
5
					", ends: " + ai.getEnds() +
5
					", ends: " + auction.getEnds() +
6
					", highest bid: " + ai.getMaxAmount()
6
					", bids: " + auction.getBids()
7
				);
7
				);
8
			}
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 declared in the same class
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    8
    while (iter.hasNext())
    9
    while (iter.hasNext())
    9
    AuctionInfo ai = (AuctionInfo)iter.next();
    9
    AuctionInfo ai = (AuctionInfo)iter.next();
    Preondition Violations
    Unmatched statement AuctionInfo ai=(AuctionInfo)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                          
                                                                                                      
    10
    AuctionItem auction = (AuctionItem)iter.next();
    Preondition Violations
    Unmatched statement AuctionItem auction=(AuctionItem)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    AuctionItem auction = (AuctionItem)iter.next();
    10
    System.out.println("Auction: " + ai.getId() + " - " + ai.getDescription() + ", ends: " + ai.getEnds() + ", highest bid: " + ai.getMaxAmount());
                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                
    11
    System.out.println("Auction: " + auction.getId() + " - " + auction.getDescription() + ", ends: " + auction.getEnds() + ", bids: " + auction.getBids());
    Precondition Violations (3)
    Row Violation
    1Unmatched statement AuctionInfo ai=(AuctionInfo)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement AuctionItem auction=(AuctionItem)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero