if ( getChildren() != null ) { for ( Iterator it = getChildren().iterator(); it.hasNext(); ) { ChildWithManyToOne child = ( ChildWithManyToOne ) it.next(); child.setParent( null ); } }
if ( getChildren() != null ) { for ( Iterator it = getChildren().iterator(); it.hasNext(); ) { ChildWithBidirectionalManyToMany child = ( ChildWithBidirectionalManyToMany ) it.next(); child.removeParent( this ); } }
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/association/bidirectional/onetomany/ParentWithBidirectionalOneToMany.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/event/collection/association/bidirectional/manytomany/ParentWithBidirectionalManyToMany.java
Method name: void newChildren(Collection) Method name: void clearChildren()
Number of AST nodes: 4 Number of AST nodes: 4
1
if ( getChildren() != null ) {
1
if ( getChildren() != null ) {
2
			for ( Iterator it = getChildren().iterator(); it.hasNext(); ) {
2
			for ( Iterator it = getChildren().iterator(); it.hasNext(); ) {
3
				ChildWithManyToOne child =  ( ChildWithManyToOne ) it.next();
3
				ChildWithBidirectionalManyToMany child = ( ChildWithBidirectionalManyToMany ) it.next();
4
				child.setParent( null );
4
				child.removeParent( this );
5
			}
5
			}
6
		}
6
		}
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons10
  1. {Non-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)0.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    if (getChildren() != null)
    1
    if (getChildren() != null)
    4
    for (Iterator it = getChildren().iterator(); it.hasNext(); )
    2
    for (Iterator it = getChildren().iterator(); it.hasNext(); )
    5
    ChildWithManyToOne child = (ChildWithManyToOne)it.next();
    5
    ChildWithManyToOne child = (ChildWithManyToOne)it.next();
    3
    ChildWithBidirectionalManyToMany child = (ChildWithBidirectionalManyToMany)it.next();
    Differences
    Expression1Expression2Difference
    org.hibernate.test.event.collection.association.bidirectional.onetomany.ChildWithManyToOneorg.hibernate.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToManySUBCLASS_TYPE_MISMATCH
    org.hibernate.test.event.collection.association.bidirectional.onetomany.ChildWithManyToOneorg.hibernate.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToManySUBCLASS_TYPE_MISMATCH
    org.hibernate.test.event.collection.association.bidirectional.onetomany.ChildWithManyToOneorg.hibernate.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToManySUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (ChildWithManyToOne)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (ChildWithBidirectionalManyToMany)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    ChildWithBidirectionalManyToMany child = (ChildWithBidirectionalManyToMany)it.next();
    6
    child.setParent(null);
    6
    child.setParent(null);
    4
    child.removeParent(this);
    Differences
    Expression1Expression2Difference
    setParentremoveParentMETHOD_INVOCATION_NAME_MISMATCH
    nullthisTYPE_COMPATIBLE_REPLACEMENT
    org.hibernate.test.event.collection.association.bidirectional.onetomany.ChildWithManyToOneorg.hibernate.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToManySUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression child.setParent(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression child.removeParent(this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression child.setParent(null) is a void method call, and thus it cannot be parameterized
    Expression child.removeParent(this) is a void method call, and thus it cannot be parameterized
    4
    child.removeParent(this);
    Precondition Violations (6)
    Row Violation
    1Expression (ChildWithManyToOne)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression (ChildWithBidirectionalManyToMany)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression child.setParent(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression child.removeParent(this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression child.setParent(null) is a void method call, and thus it cannot be parameterized
    6Expression child.removeParent(this) is a void method call, and thus it cannot be parameterized