for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) { if ( includeProperty[i] && isPropertyOfTable( i, j ) ) { getPropertyTypes()[i].nullSafeSet( ps, fields[i], index, includeColumns[i], session ); //index += getPropertyColumnSpan( i ); index += ArrayHelper.countTrue( includeColumns[i] ); //TODO: this is kinda slow... } }
if ( isPropertyOfTable( i, j ) && versionability[i] ) { // this property belongs to the table and it is not specifically // excluded from optimistic locking by optimistic-lock="false" boolean[] settable = types[i].toColumnNullness( loadedState[i], getFactory() ); types[i].nullSafeSet( delete, loadedState[i], index, settable, session ); index += ArrayHelper.countTrue( settable ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
Method name: int dehydrate(Serializable, Object[], Object, boolean[], boolean[][], int, PreparedStatement, SessionImplementor, int) Method name: void delete(Serializable, Object, int, Object, String, SessionImplementor, Object[])
Number of AST nodes: 4 Number of AST nodes: 4
1
for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) {
1
if ( i
2
			if ( includeProperty[i] && isPropertyOfTable( i, j 
2
sPropertyOfTable( i, j ) && versionability[i] ) {
3
							// this property belongs to the table and it is not specifically
4
							// excluded from optimistic locking by optimistic-lock="false"
3
) ) {
5
							boolean[] settable = types[i].toColumnNullness( loadedState[i], getFactory() );
4
				getPropertyTypes()[i].nullSafeSet( ps, fields[i], index, includeColumns[i], session );
6
							types[i].nullSafeSet( 
5
				//index += getPropertyColumnSpan( i );
6
				index += ArrayHelper.countTrue( includeColumns[i] ); //TODO:  this is kinda slow...
7
delete, loadedState[i], index, settable, session );
8
							index += ArrayHelper.countTrue( settable );
7
			}
9
			
8
		}
10
			}
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.4
Clones locationClones are declared in the same class
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    4
    if (includeProperty[i] && isPropertyOfTable(i, j))
    4
    if (includeProperty[i] && isPropertyOfTable(i, j))
    35
    if (isPropertyOfTable(i, j) && versionability[i])
    Differences
    Expression1Expression2Difference
    includeProperty[i]isPropertyOfTable(i,j)TYPE_COMPATIBLE_REPLACEMENT
    isPropertyOfTable(i,j)versionability[i]TYPE_COMPATIBLE_REPLACEMENT
    35
    if (isPropertyOfTable(i, j) && versionability[i])
                                                                                                                                                                
    36
    boolean[] settable = types[i].toColumnNullness(loadedState[i], getFactory());
    Preondition Violations
    Unmatched statement boolean[] settable=types[i].toColumnNullness(loadedState[i],getFactory()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    36
    boolean[] settable = types[i].toColumnNullness(loadedState[i], getFactory());
    5
    getPropertyTypes()[i].nullSafeSet(ps, fields[i], index, includeColumns[i], session);
    5
    getPropertyTypes()[i].nullSafeSet(ps, fields[i], index, includeColumns[i], session);
    37
    types[i].nullSafeSet(delete, loadedState[i], index, settable, session);
    Differences
    Expression1Expression2Difference
    psdeleteVARIABLE_NAME_MISMATCH
    fieldsloadedStateVARIABLE_NAME_MISMATCH
    includeColumns[i]settableTYPE_COMPATIBLE_REPLACEMENT
    getPropertyTypes()typesTYPE_COMPATIBLE_REPLACEMENT
    37
    types[i].nullSafeSet(delete, loadedState[i], index, settable, session);
    6
    index += ArrayHelper.countTrue(includeColumns[i]);
    6
    index += ArrayHelper.countTrue(includeColumns[i]);
    38
    index += ArrayHelper.countTrue(settable);
    Differences
    Expression1Expression2Difference
    includeColumns[i]settableTYPE_COMPATIBLE_REPLACEMENT
    38
    index += ArrayHelper.countTrue(settable);
    Precondition Violations (1)
    Row Violation
    1Unmatched statement boolean[] settable=types[i].toColumnNullness(loadedState[i],getFactory()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted