String[] aliases = new String[ sqlIdentifiers.length ]; for ( int i=0; i<sqlIdentifiers.length; i++ ) { aliases[i] = toAliasString(sqlIdentifiers[i]); } return aliases;
int length=objects.length; String[] result = new String[length]; for (int i=0; i<length; i++) { result[i] = objects[i].toString(); } return result;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/sql/Alias.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/util/ArrayHelper.java
Method name: String[] toAliasStrings(String[]) Method name: String[] toStringArray(Object[])
Number of AST nodes: 4 Number of AST nodes: 5
1
int length=objects.length;
1
String[] aliases = new String[ sqlIdentifiers.length ];
2
		String[] result = new String[length];
2
		for ( int i=0; i<sqlIdentifiers.length; i++ ) {
3
		for (int i=0; i<length; i++) {
3
			aliases[i] = toAliasString(sqlIdentifiers[i]);
4
			result[i] = objects[i].toString();
4
		}
5
		}
5
		return aliases;
6
		return result;
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 comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                              
    1
    int length = objects.length;
    1
    String[] aliases = new String[sqlIdentifiers.length];
    1
    String[] aliases = new String[sqlIdentifiers.length];
    2
    String[] result = new String[length];
    Differences
    Expression1Expression2Difference
    aliasesresultVARIABLE_NAME_MISMATCH
    sqlIdentifiers.lengthlengthTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression length cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    String[] result = new String[length];
    2
    for (int i = 0; i < sqlIdentifiers.length; i++)
    2
    for (int i = 0; i < sqlIdentifiers.length; i++)
    3
    for (int i = 0; i < length; i++)
    Differences
    Expression1Expression2Difference
    sqlIdentifiers.lengthlengthTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression length cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    for (int i = 0; i < length; i++)
    3
    aliases[i] = toAliasString(sqlIdentifiers[i]);
    3
    aliases[i] = toAliasString(sqlIdentifiers[i]);
    Preondition Violations
    Unmatched statement aliases[i]=toAliasString(sqlIdentifiers[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                  
                                                                          
    4
    result[i] = objects[i].toString();
    Preondition Violations
    Unmatched statement result[i]=objects[i].toString(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    result[i] = objects[i].toString();
    4
    return aliases;
    4
    return aliases;
    5
    return result;
    Differences
    Expression1Expression2Difference
    aliasesresultVARIABLE_NAME_MISMATCH
    5
    return result;
    Precondition Violations (4)
    Row Violation
    1Expression length cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression length cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement aliases[i]=toAliasString(sqlIdentifiers[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement result[i]=objects[i].toString(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted