Table table = (Table) iter.next(); if ( table.isPhysicalTable() ) { Iterator subIter = table.getForeignKeyIterator(); while ( subIter.hasNext() ) { ForeignKey fk = (ForeignKey) subIter.next(); if ( fk.isPhysicalConstraint() ) { script.add( fk.sqlDropString( dialect, defaultCatalog, defaultSchema ) ); } } }
while ( properties.hasNext() ) { Property prop = (Property) properties.next(); if ( prop.getValue() instanceof Component ) { //TODO: remove use of instanceof! Component component = (Component) prop.getValue(); checkPropertyColumnDuplication( distinctColumns, component.getPropertyIterator() ); } else { if ( prop.isUpdateable() || prop.isInsertable() ) { checkColumnDuplication( distinctColumns, prop.getColumnIterator() ); } } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/Configuration.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/mapping/PersistentClass.java
Method name: String[] generateDropSchemaScript(Dialect) Method name: void checkPropertyColumnDuplication(Set, Iterator)
Number of AST nodes: 7 Number of AST nodes: 7
1
Table table = (Table) iter.next();
2
				if ( table.isPhysicalTable() ) {
1
while ( properties.hasNext() ) {
3
					Iterator subIter = table.getForeignKeyIterator();
2
			
4
					while ( subIter.hasNext() ) {
5
						ForeignKey fk = (ForeignKey) subIter.next
3
Property prop = (Property) properties.next();
4
			if ( prop.getValue() instanceof Component ) { //TODO: remove use of instanceof!
6
();
5
				Component component = (Component) prop.getValue();
7
						if ( fk.isPhysicalConstraint() ) {
6
				checkPropertyColumnDuplication( distinctColumns, component.getPropertyIterator() );
8
			
7
			}
9
				script.add(
8
			
10
									fk.sqlDropString(
11
											dialect,
12
											defaultCatalog,
13
											defaultSchema
14
										)
15
								
9
else {
10
				if ( prop.isUpdateable() || prop.isInsertable() ) {
16
);
11
					checkColumnDuplication( distinctColumns, prop.getColumnIterator() );
17
						}
12
				}
18
					}
13
			
19
		
14
}
20
		}
15
		}
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are in different classes
Number of node comparisons1