for (int i = 0; i < colInfos.length; i++) { TableColumnInfo colInfo = colInfos[i]; if (colInfo.getColumnName().equals(columnName)) { return colInfo; } } return null;
for (int i = 0; i < schemaDetails.length; i++) { if(schemaDetails[i].getSchemaName().equals(schemaName)) { return schemaDetails[i]; } } return null;
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/db/ColumnListDialog.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/db/SQLAliasSchemaProperties.java
Method name: TableColumnInfo getColInfoByName(String) Method name: SQLAliasSchemaDetailProperties getMatchingDetail(String, SQLAliasSchemaDetailProperties[])
Number of AST nodes: 5 Number of AST nodes: 4
1
for (int i = 0; i < colInfos.length; i++) {
1
for (int i = 0; i < schemaDetails.length; i++)
2
      
2
      {
3
      TableColumnInfo colInfo = colInfos[i];
3
      
4
            if (colInfo.getColumnName().equals(columnName)) {
4
   if(schemaDetails[i].getSchemaName().equals(
5
schemaName))
5
    
6
         {
6
            return colInfo;
7
            return 
7
   
8
schemaDetails[i];
8
         }
9
         }
9
        }
10
      
10
  
11
}
11
      return null;
12
      return null;
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 in different classes
Number of node comparisons4
  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 fragment2
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    for (int i = 0; i < colInfos.length; i++)
    1
    for (int i = 0; i < colInfos.length; i++)
    1
    for (int i = 0; i < schemaDetails.length; i++)
    Differences
    Expression1Expression2Difference
    colInfosschemaDetailsVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.sql.TableColumnInfo[]net.sourceforge.squirrel_sql.client.gui.db.SQLAliasSchemaDetailProperties[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable colInfos.length does not match with type int of variable schemaDetails.length
    • Make classes net.sourceforge.squirrel_sql.fw.sql.TableColumnInfo[] and net.sourceforge.squirrel_sql.client.gui.db.SQLAliasSchemaDetailProperties[] extend a common superclass
    1
    for (int i = 0; i < schemaDetails.length; i++)
                                                                                                                        
    2
    if (schemaDetails[i].getSchemaName().equals(schemaName))
    Preondition Violations
    Unmatched statement if(schemaDetails[i].getSchemaName().equals(schemaName)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    if (schemaDetails[i].getSchemaName().equals(schemaName))
                                                          
    3
    return schemaDetails[i];
    Preondition Violations
    Unmatched statement return schemaDetails[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return schemaDetails[i];
    3
    return schemaDetails[i];
    2
    TableColumnInfo colInfo = colInfos[i];
    2
    TableColumnInfo colInfo = colInfos[i];
    Preondition Violations
    Unmatched statement TableColumnInfo colInfo=colInfos[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                  
    3
    if (colInfo.getColumnName().equals(columnName))
                                                                                                      
    4
    return colInfo;
    4
    return colInfo;
    Preondition Violations
    Unmatched return colInfo;
                                        
    5
    return null;
    4
    return null;
    Precondition Violations (6)
    Row Violation
    1Type int of variable colInfos.length does not match with type int of variable schemaDetails.length
    2Unmatched statement if(schemaDetails[i].getSchemaName().equals(schemaName)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement return schemaDetails[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return schemaDetails[i];
    5Unmatched statement TableColumnInfo colInfo=colInfos[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched return colInfo;