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 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 10 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 1.5 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
8 | while (iter.hasNext()) | | 9 | while (iter.hasNext()) |
9 | AuctionInfo ai = (AuctionInfo)iter.next(); | | | |
| | | 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 |
1 | 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 |
2 | 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 |
3 | The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero |