for (int i = 0; i < tables.length; ++i) { ObjectTreeNode child = new ObjectTreeNode(session, tables[i]); child.setUserObject(getNodeDisplayText(stmt, tables[i])); childNodes.add(child); }
for (int i = 0; i < row.length; ++i) { String cellValue = CellComponentFactory.renderObject(row[i], colDefs[i]); buf.append(format(cellValue, colDefs[i].getDisplayWidth(), ' ')); }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree/expanders/TableTypeExpander.java File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/DataSetViewerTextPanel.java
Method name: List createChildren(ISession, ObjectTreeNode) Method name: void addRow(Object[])
Number of AST nodes: 4 Number of AST nodes: 3
1
for (int i = 0; i < tables.length; ++i)
1
for (int i = 0; i < row.length; ++i)
2
			{
2
		{
3
				ObjectTreeNode child = new ObjectTreeNode(session, tables[i]);
3
			
4
				child.setUserObject(getNodeDisplayText(stmt, tables[i]));
5
				childNodes.add(child
4
String cellValue = CellComponentFactory.renderObject(row[i], colDefs[i]);
6
);
5
			buf.append(format(cellValue, colDefs[i].getDisplayWidth(), ' '));
7
			}
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 comparisons12
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    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.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    14
    for (int i = 0; i < tables.length; ++i)
    14
    for (int i = 0; i < tables.length; ++i)
    4
    for (int i = 0; i < row.length; ++i)
    Differences
    Expression1Expression2Difference
    tablesrowVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.sql.ITableInfo[]java.lang.Object[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable tables.length does not match with type int of variable row.length
    • Make classes net.sourceforge.squirrel_sql.fw.sql.ITableInfo[] and java.lang.Object[] extend a common superclass
    4
    for (int i = 0; i < row.length; ++i)
                                                                                                                                                      
    5
    String cellValue = CellComponentFactory.renderObject(row[i], colDefs[i]);
    Preondition Violations
    Unmatched statement String cellValue=CellComponentFactory.renderObject(row[i],colDefs[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    String cellValue = CellComponentFactory.renderObject(row[i], colDefs[i]);
                                                                                                                                        
    6
    buf.append(format(cellValue, colDefs[i].getDisplayWidth(), ' '));
    Preondition Violations
    Unmatched statement buf.append(format(cellValue,colDefs[i].getDisplayWidth(),' ')); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    buf.append(format(cellValue, colDefs[i].getDisplayWidth(), ' '));
    15
    ObjectTreeNode child = new ObjectTreeNode(session, tables[i]);
    15
    ObjectTreeNode child = new ObjectTreeNode(session, tables[i]);
    Preondition Violations
    Unmatched statement ObjectTreeNode child=new ObjectTreeNode(session,tables[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement ObjectTreeNode child=new ObjectTreeNode(session,tables[i]); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                                  
    16
    child.setUserObject(getNodeDisplayText(stmt, tables[i]));
    16
    child.setUserObject(getNodeDisplayText(stmt, tables[i]));
    Preondition Violations
    Unmatched statement child.setUserObject(getNodeDisplayText(stmt,tables[i])); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                            
    17
    childNodes.add(child);
                                                        
    Precondition Violations (7)
    Row Violation
    1Type int of variable tables.length does not match with type int of variable row.length
    2Unmatched statement String cellValue=CellComponentFactory.renderObject(row[i],colDefs[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement buf.append(format(cellValue,colDefs[i].getDisplayWidth(),' ')); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement ObjectTreeNode child=new ObjectTreeNode(session,tables[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement ObjectTreeNode child=new ObjectTreeNode(session,tables[i]); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    6Unmatched statement child.setUserObject(getNodeDisplayText(stmt,tables[i])); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero