int[] results = null; int count = 0; int span = properties.length; for ( int i = 0; i < span; i++ ) { final boolean dirty = currentState[i] != LazyPropertyInitializer.UNFETCHED_PROPERTY && properties[i].isDirtyCheckable( anyUninitializedProperties ) && properties[i].getType().isDirty( previousState[i], currentState[i], includeColumns[i], session ); if ( dirty ) { if ( results == null ) { results = new int[span]; } results[count++] = i; } } if ( count == 0 ) { return null; } else { int[] trimmed = new int[count]; System.arraycopy( results, 0, trimmed, 0, count ); return trimmed; }
int[] results = null; int count = 0; int span = properties.length; for ( int i = 0; i < span; i++ ) { final boolean modified = currentState[i]!=LazyPropertyInitializer.UNFETCHED_PROPERTY && properties[i].isDirtyCheckable(anyUninitializedProperties) && properties[i].getType().isModified( previousState[i], currentState[i], includeColumns[i], session ); if ( modified ) { if ( results == null ) { results = new int[span]; } results[count++] = i; } } if ( count == 0 ) { return null; } else { int[] trimmed = new int[count]; System.arraycopy( results, 0, trimmed, 0, count ); return trimmed; }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/TypeFactory.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/TypeFactory.java
Method name: int[] findDirty(StandardProperty[], Object[], Object[], boolean[][], boolean, SessionImplementor) Method name: int[] findModified(StandardProperty[], Object[], Object[], boolean[][], boolean, SessionImplementor)
Number of AST nodes: 14 Number of AST nodes: 14
1
int[] results = null;
1
int[] results = null;
2
		int count = 0;
2
		int count = 0;
3
		int span = properties.length;
3
		int span = properties.length;
4
		for ( int i = 0; i < span; i++ ) {
4
		for ( int i = 0; i < span; i++ ) {
5
			final boolean dirty = currentState[i] != LazyPropertyInitializer.UNFETCHED_PROPERTY
5
			final boolean modified = currentState[i]!=LazyPropertyInitializer.UNFETCHED_PROPERTY
6
					&& properties[i].isDirtyCheckable( anyUninitializedProperties )
6
					&& properties[i].isDirtyCheckable(anyUninitializedProperties)
7
					&& properties[i].getType().isDirty( previousState[i], currentState[i], includeColumns[i], session );
7
					&& properties[i].getType().isModified( previousState[i], currentState[i], includeColumns[i], session );
8
			if ( dirty ) {
8
			if ( modified ) {
9
				if ( results == null ) {
9
				if ( results == null ) {
10
					results = new int[span];
10
					results = new int[span];
11
				}
11
				}
12
				results[count++] = i;
12
				results[count++] = i;
13
			}
13
			}
14
		}
14
		}
15
		if ( count == 0 ) {
15
		if ( count == 0 ) {
16
			return null;
16
			return null;
17
		}
17
		}
18
		else {
18
		else {
19
			int[] trimmed = new int[count];
19
			int[] trimmed = new int[count];
20
			System.arraycopy( results, 0, trimmed, 0, count );
20
			System.arraycopy( results, 0, trimmed, 0, count );
21
			return trimmed;
21
			return trimmed;
22
		}
22
		}
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.3
Clones locationClones are declared in the same class
Number of node comparisons46
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    int[] results = null;
    1
    int[] results = null;
    2
    int count = 0;
    2
    int count = 0;
    3
    int span = properties.length;
    3
    int span = properties.length;
    4
    for (int i = 0; i < span; i++)
    4
    for (int i = 0; i < span; i++)
    5
    final boolean dirty = currentState[i] != LazyPropertyInitializer.UNFETCHED_PROPERTY && properties[i].isDirtyCheckable(anyUninitializedProperties) && properties[i].getType().isDirty(previousState[i], currentState[i], includeColumns[i], session);
    5
    final boolean dirty = currentState[i] != LazyPropertyInitializer.UNFETCHED_PROPERTY && properties[i].isDirtyCheckable(anyUninitializedProperties) && properties[i].getType().isDirty(previousState[i], currentState[i], includeColumns[i], session);
    5
    final boolean modified = currentState[i] != LazyPropertyInitializer.UNFETCHED_PROPERTY && properties[i].isDirtyCheckable(anyUninitializedProperties) && properties[i].getType().isModified(previousState[i], currentState[i], includeColumns[i], session);
    Differences
    Expression1Expression2Difference
    dirtymodifiedVARIABLE_NAME_MISMATCH
    isDirtyisModifiedMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression properties[i].getType().isDirty(previousState[i],currentState[i],includeColumns[i],session) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression properties[i].getType().isModified(previousState[i],currentState[i],includeColumns[i],session) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    final boolean modified = currentState[i] != LazyPropertyInitializer.UNFETCHED_PROPERTY && properties[i].isDirtyCheckable(anyUninitializedProperties) && properties[i].getType().isModified(previousState[i], currentState[i], includeColumns[i], session);
    6
    if (dirty)
    6
    if (dirty)
    6
    if (modified)
    Differences
    Expression1Expression2Difference
    dirtymodifiedVARIABLE_NAME_MISMATCH
    6
    if (modified)
    7
    if (results == null)
    7
    if (results == null)
    8
    results = new int[span];
    8
    results = new int[span];
    9
    results[count++] = i;
    9
    results[count++] = i;
    10
    if (count == 0)
    10
    if (count == 0)
    11
    return null;
    11
    return null;
    else
    else
    12
    int[] trimmed = new int[count];
    12
    int[] trimmed = new int[count];
    13
    System.arraycopy(results, 0, trimmed, 0, count);
    13
    System.arraycopy(results, 0, trimmed, 0, count);
    14
    return trimmed;
    14
    return trimmed;
    Precondition Violations (2)
    Row Violation
    1Expression properties[i].getType().isDirty(previousState[i],currentState[i],includeColumns[i],session) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression properties[i].getType().isModified(previousState[i],currentState[i],includeColumns[i],session) cannot be parameterized, because it has dependencies to/from statements that will be extracted