for (int i=0; i<5; i++) {
Parent p = new Parent( String.valueOf( i ) );
Child child = new Child( "child" + i );
child.setParent( p );
p.getChildren().add( child );
s.save( p );
parents.add(p);
}
for (int i=0; i<5; i++) {
Parent p = new Parent( String.valueOf( i ) );
Child child = new Child( "child" + i );
child.setParent( p );
p.getChildren().add( child );
s.save( p );
parents.add(p);
}
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/reattachment/ProxyReattachmentTest.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/reattachment/ProxyReattachmentTest.java
|
Method name: void testIterateWithClearBottomOfLoop()
|
|
Method name: void testIterateWithClearTopOfLoop()
|
Number of AST nodes: 7
|
|
Number of AST nodes: 7
|
|
1 | for (int i=0; i<5; i++) {↵ | | 1 | for (int i=0; i<5; i++) {↵
|
2 | Parent p = new Parent( String.valueOf( i ) );↵ | | 2 | Parent p = new Parent( String.valueOf( i ) );↵
|
3 | Child child = new Child( "child" + i );↵ | | 3 | Child child = new Child( "child" + i );↵
|
4 | child.setParent( p );↵ | | 4 | child.setParent( p );↵
|
5 | p.getChildren().add( child );↵ | | 5 | p.getChildren().add( child );↵
|
6 | s.save( p );↵ | | 6 | s.save( p );↵
|
7 | parents.add(p);↵ | | 7 | parents.add(p);↵
|
8 | } | | 8 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 49 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 7 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.8 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
4 | for (int i = 0; i < 5; i++) | | 4 | for (int i = 0; i < 5; i++) |
5 | Parent p = new Parent(String.valueOf(i)); | | 5 | Parent p = new Parent(String.valueOf(i)); |
6 | Child child = new Child("child" + i); | | 6 | Child child = new Child("child" + i); |
7 | | | 7 | |
8 | p.getChildren().add(child); | | 8 | p.getChildren().add(child); |
9 | | | 9 | |
10 | | | 10 | |
Precondition Violations (0)
Row |
Violation |