for ( int i = 0; i < propertySpan; i++ ) { int[] subtypes = propertyTypes[i].sqlTypes( mapping ); for ( int j = 0; j < subtypes.length; j++ ) { sqlTypes[n++] = subtypes[j]; } }
for ( int i = 0; i < replacements.length; i++ ) { for ( int j = 0; j < strings.length; j++ ) { results[n++] = replaceOnce( strings[j], placeholder, replacements[i] ); } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/ComponentType.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/util/StringHelper.java
Method name: int[] sqlTypes(Mapping) Method name: String[] multiply(String[], String, String[])
Number of AST nodes: 4 Number of AST nodes: 3
1
for ( int i = 0; i < propertySpan; i++ ) {
1
for ( int i = 0; i < 
2
			int[] subtypes = propertyTypes[i].sqlTypes( mapping );
2
replacements.length; i++ ) {
3
			for ( int j = 0; j < subtypes.length; j++ ) {
3
			for ( int j = 0; j < strings.length; j++ ) {
4
				sqlTypes[n++] = subtypes[j];
4
				results[n++] = replaceOnce( strings[j], placeholder, replacements[i] );
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
Number of node comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    3
    for (int i = 0; i < propertySpan; i++)
    3
    for (int i = 0; i < propertySpan; i++)
    3
    for (int i = 0; i < replacements.length; i++)
    Differences
    Expression1Expression2Difference
    propertySpanreplacements.lengthTYPE_COMPATIBLE_REPLACEMENT
    3
    for (int i = 0; i < replacements.length; i++)
    4
    int[] subtypes = propertyTypes[i].sqlTypes(mapping);
    4
    int[] subtypes = propertyTypes[i].sqlTypes(mapping);
    Preondition Violations
    Unmatched statement int[] subtypes=propertyTypes[i].sqlTypes(mapping); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                              
    5
    for (int j = 0; j < subtypes.length; j++)
    5
    for (int j = 0; j < subtypes.length; j++)
    4
    for (int j = 0; j < strings.length; j++)
    Differences
    Expression1Expression2Difference
    subtypesstringsVARIABLE_NAME_MISMATCH
    int[]java.lang.String[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int[] of variable subtypes does not match with type java.lang.String[] of variable strings
    • Make classes int[] and java.lang.String[] extend a common superclass
    4
    for (int j = 0; j < strings.length; j++)
                                                                                                                                            
    5
    results[n++] = replaceOnce(strings[j], placeholder, replacements[i]);
    Preondition Violations
    Unmatched statement results[n++]=replaceOnce(strings[j],placeholder,replacements[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    results[n++] = replaceOnce(strings[j], placeholder, replacements[i]);
    6
    sqlTypes[n++] = subtypes[j];
    6
    sqlTypes[n++] = subtypes[j];
    Preondition Violations
    Unmatched statement sqlTypes[n++]=subtypes[j]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                              
    Precondition Violations (5)
    Row Violation
    1Unmatched statement int[] subtypes=propertyTypes[i].sqlTypes(mapping); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Type int[] of variable subtypes does not match with type java.lang.String[] of variable strings
    3Unmatched statement results[n++]=replaceOnce(strings[j],placeholder,replacements[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement sqlTypes[n++]=subtypes[j]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Clone fragment #1 returns variables i, j , while Clone fragment #2 returns variables i, j