if ( child instanceof ChildWithBidirectionalManyToMany ) { ChildWithBidirectionalManyToMany childWithManyToMany = ( ChildWithBidirectionalManyToMany ) child; if ( ( ( PersistentCollection ) childWithManyToMany.getParents( ) ).wasInitialized() ) { checkResult( listeners, listeners.getInitializeCollectionListener(), childWithManyToMany, index++ ); } }
if ( oldChild instanceof ChildWithBidirectionalManyToMany ) { ChildWithBidirectionalManyToMany oldChildWithManyToMany = ( ChildWithBidirectionalManyToMany ) oldChild; if ( ( ( PersistentCollection ) oldChildWithManyToMany.getParents() ).wasInitialized() ) { checkResult( listeners, listeners.getInitializeCollectionListener(), oldChildWithManyToMany, index++ ); } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/event/collection/AbstractCollectionEventTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/event/collection/AbstractCollectionEventTest.java
Method name: void testUpdateParentOneChildToNoneByRemove() Method name: void testUpdateParentTwoChildrenToOne()
Number of AST nodes: 4 Number of AST nodes: 4
1
if ( child instanceof ChildWithBidirectionalManyToMany ) {
1
if ( oldChild instanceof ChildWithBidirectionalManyToMany ) {
2
			ChildWithBidirectionalManyToMany childWithManyToMany = ( ChildWithBidirectionalManyToMany ) child;
2
			ChildWithBidirectionalManyToMany oldChildWithManyToMany = ( ChildWithBidirectionalManyToMany ) oldChild;
3
			if ( ( ( PersistentCollection ) childWithManyToMany.getParents( ) ).wasInitialized() ) {
3
			if ( ( ( PersistentCollection ) oldChildWithManyToMany.getParents() ).wasInitialized() ) {
4
				checkResult( listeners, listeners.getInitializeCollectionListener(), childWithManyToMany, index++ );
4
				checkResult( listeners, listeners.getInitializeCollectionListener(), oldChildWithManyToMany, index++ );
5
			}
5
			}
6
		}
6
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are declared in the same class
Number of node comparisons8
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    17
    if (child instanceof ChildWithBidirectionalManyToMany)
    17
    if (child instanceof ChildWithBidirectionalManyToMany)
    24
    if (oldChild instanceof ChildWithBidirectionalManyToMany)
    Differences
    Expression1Expression2Difference
    childoldChildVARIABLE_NAME_MISMATCH
    24
    if (oldChild instanceof ChildWithBidirectionalManyToMany)
    18
    ChildWithBidirectionalManyToMany childWithManyToMany = (ChildWithBidirectionalManyToMany)child;
    18
    ChildWithBidirectionalManyToMany childWithManyToMany = (ChildWithBidirectionalManyToMany)child;
    25
    ChildWithBidirectionalManyToMany oldChildWithManyToMany = (ChildWithBidirectionalManyToMany)oldChild;
    Differences
    Expression1Expression2Difference
    childWithManyToManyoldChildWithManyToManyVARIABLE_NAME_MISMATCH
    childoldChildVARIABLE_NAME_MISMATCH
    25
    ChildWithBidirectionalManyToMany oldChildWithManyToMany = (ChildWithBidirectionalManyToMany)oldChild;
    19
    if (((PersistentCollection)childWithManyToMany.getParents()).wasInitialized())
    19
    if (((PersistentCollection)childWithManyToMany.getParents()).wasInitialized())
    26
    if (((PersistentCollection)oldChildWithManyToMany.getParents()).wasInitialized())
    Differences
    Expression1Expression2Difference
    childWithManyToManyoldChildWithManyToManyVARIABLE_NAME_MISMATCH
    26
    if (((PersistentCollection)oldChildWithManyToMany.getParents()).wasInitialized())
    20
    checkResult(listeners, listeners.getInitializeCollectionListener(), childWithManyToMany, index++);
    20
    checkResult(listeners, listeners.getInitializeCollectionListener(), childWithManyToMany, index++);
    27
    checkResult(listeners, listeners.getInitializeCollectionListener(), oldChildWithManyToMany, index++);
    Differences
    Expression1Expression2Difference
    childWithManyToManyoldChildWithManyToManyVARIABLE_NAME_MISMATCH
    27
    checkResult(listeners, listeners.getInitializeCollectionListener(), oldChildWithManyToMany, index++);
    Precondition Violations (0)
    Row Violation