if ( hasIdentifier ) { update.setPrimaryKeyColumnNames( new String[]{ identifierColumnName } ); } else if ( hasIndex && !indexContainsFormula ) { update.setPrimaryKeyColumnNames( ArrayHelper.join( keyColumnNames, indexColumnNames ) ); } else { update.setPrimaryKeyColumnNames( ArrayHelper.join( keyColumnNames, elementColumnNames, elementColumnIsInPrimaryKey ) ); }
if ( hasIdentifier ) { delete.setPrimaryKeyColumnNames( new String[]{ identifierColumnName } ); } else if ( hasIndex && !indexContainsFormula ) { delete.setPrimaryKeyColumnNames( ArrayHelper.join( keyColumnNames, indexColumnNames ) ); } else { delete.setPrimaryKeyColumnNames( ArrayHelper.join( keyColumnNames, elementColumnNames, elementColumnIsInPrimaryKey ) ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/collection/BasicCollectionPersister.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/collection/BasicCollectionPersister.java
Method name: String generateUpdateRowString() Method name: String generateDeleteRowString()
Number of AST nodes: 5 Number of AST nodes: 5
1
if ( hasIdentifier ) {
1
if ( hasIdentifier ) {
2
			update.setPrimaryKeyColumnNames( new String[]{ identifierColumnName } );
2
			delete.setPrimaryKeyColumnNames( new String[]{ identifierColumnName } );
3
		}
3
		}
4
		else if ( hasIndex && !indexContainsFormula ) {
4
		else if ( hasIndex && !indexContainsFormula ) {
5
			update.setPrimaryKeyColumnNames( ArrayHelper.join( keyColumnNames, indexColumnNames ) );
5
			delete.setPrimaryKeyColumnNames( ArrayHelper.join( keyColumnNames, indexColumnNames ) );
6
		}
6
		}
7
		else {
7
		else {
8
			update.setPrimaryKeyColumnNames( ArrayHelper.join( keyColumnNames, elementColumnNames, elementColumnIsInPrimaryKey ) );
8
			delete.setPrimaryKeyColumnNames( ArrayHelper.join( keyColumnNames, elementColumnNames, elementColumnIsInPrimaryKey ) );
9
		}
9
		}
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 declared in the same class
Number of node comparisons20
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)42.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    if (hasIdentifier)
    2
    if (hasIdentifier)
                                                                                                                                                  
    3
    delete.setPrimaryKeyColumnNames(new String[] {identifierColumnName});
    Preondition Violations
    Unmatched statement delete.setPrimaryKeyColumnNames(new String[]{identifierColumnName}); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    delete.setPrimaryKeyColumnNames(new String[] {identifierColumnName});
    4
    update.setPrimaryKeyColumnNames(new String[] {identifierColumnName});
    4
    update.setPrimaryKeyColumnNames(new String[] {identifierColumnName});
    Preondition Violations
    Unmatched statement update.setPrimaryKeyColumnNames(new String[]{identifierColumnName}); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                  
    5
    else if (hasIndex && !indexContainsFormula)
    4
    else if (hasIndex && !indexContainsFormula)
                                                                                                                                                                                
    5
    delete.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames, indexColumnNames));
    Preondition Violations
    Unmatched statement delete.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames,indexColumnNames)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    delete.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames, indexColumnNames));
    6
    update.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames, indexColumnNames));
    6
    update.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames, indexColumnNames));
    Preondition Violations
    Unmatched statement update.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames,indexColumnNames)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                                
    else
            
                                                                                                                                                                                                                                            
    6
    delete.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames, elementColumnNames, elementColumnIsInPrimaryKey));
    Preondition Violations
    Unmatched statement delete.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames,elementColumnNames,elementColumnIsInPrimaryKey)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6
    delete.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames, elementColumnNames, elementColumnIsInPrimaryKey));
    7
    update.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames, elementColumnNames, elementColumnIsInPrimaryKey));
    7
    update.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames, elementColumnNames, elementColumnIsInPrimaryKey));
    Preondition Violations
    Unmatched statement update.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames,elementColumnNames,elementColumnIsInPrimaryKey)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                                                                                            
    Precondition Violations (6)
    Row Violation
    1Unmatched statement delete.setPrimaryKeyColumnNames(new String[]{identifierColumnName}); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement update.setPrimaryKeyColumnNames(new String[]{identifierColumnName}); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement delete.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames,indexColumnNames)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement update.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames,indexColumnNames)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement delete.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames,elementColumnNames,elementColumnIsInPrimaryKey)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement update.setPrimaryKeyColumnNames(ArrayHelper.join(keyColumnNames,elementColumnNames,elementColumnIsInPrimaryKey)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted