Locale[] availableLocales = getAvailableLocales(); String[] result = new String[availableLocales.length]; for (int i = 0; i < availableLocales.length; i++) { result[i] = availableLocales[i].toString(); } return result;
ObjectTreeNode[] nodes = getSelectedNodes(); IDatabaseObjectInfo[] dbObjects = new IDatabaseObjectInfo[nodes.length]; for (int i = 0; i < nodes.length; ++i) { dbObjects[i] = nodes[i].getDatabaseObjectInfo(); } return dbObjects;
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/util/LocaleUtils.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree/ObjectTree.java
Method name: String[] getAvailableLocaleStrings() Method name: IDatabaseObjectInfo[] getSelectedDatabaseObjects()
Number of AST nodes: 5 Number of AST nodes: 5
1
Locale[] availableLocales = getAvailableLocales();
2
		String[] result = new String[availableLocal
1
ObjectTreeNode[] nodes = getSelectedNodes();
3
es.length];
2
		IDatabaseObjectInfo[] dbObjects = new IDatabaseObjectInfo[nodes.length];
4
		for (int i = 0; i < availableLocales.length; i++) {
3
		for (int i = 0; i < nodes.length; ++
5
			result[i] = availableLocales[i].toString
4
i)
5
		{
6
();
6
			dbObjects[i] = nodes[i].getDatabaseObjectInfo();
7
		}
7
		}
8
		return result;
8
		return dbObjects;
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.9
Clones locationClones are in different classes
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)2.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                              
    1
    ObjectTreeNode[] nodes = getSelectedNodes();
    1
    Locale[] availableLocales = getAvailableLocales();
                                                                                                          
                                                                                                                                                      
    2
    IDatabaseObjectInfo[] dbObjects = new IDatabaseObjectInfo[nodes.length];
    2
    String[] result = new String[availableLocales.length];
                                                                                                                  
    3
    for (int i = 0; i < availableLocales.length; i++)
    3
    for (int i = 0; i < availableLocales.length; i++)
    3
    for (int i = 0; i < nodes.length; ++i)
    Differences
    Expression1Expression2Difference
    availableLocalesnodesVARIABLE_NAME_MISMATCH
    java.util.Locale[]net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode[]VARIABLE_TYPE_MISMATCH
    java.util.Locale[]net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode[]VARIABLE_TYPE_MISMATCH
    java.util.Locale[]net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode[]VARIABLE_TYPE_MISMATCH
    java.util.Locale[]net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable availableLocales.length does not match with type int of variable nodes.length
    • Make classes java.util.Locale[] and net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode[] extend a common superclass
    Type int of variable availableLocales.length does not match with type int of variable nodes.length
    • Make classes java.util.Locale[] and net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode[] extend a common superclass
    Type java.util.Locale[] of variable availableLocales does not match with type int of variable nodes.length
    • Make classes java.util.Locale[] and net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode[] extend a common superclass
    Type int of variable availableLocales.length does not match with type net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode[] of variable nodes
    • Make classes java.util.Locale[] and net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode[] extend a common superclass
    3
    for (int i = 0; i < nodes.length; ++i)
                                                                                                      
    4
    dbObjects[i] = nodes[i].getDatabaseObjectInfo();
    Preondition Violations
    Unmatched statement dbObjects[i]=nodes[i].getDatabaseObjectInfo(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    dbObjects[i] = nodes[i].getDatabaseObjectInfo();
    4
    result[i] = availableLocales[i].toString();
    4
    result[i] = availableLocales[i].toString();
    Preondition Violations
    Unmatched statement result[i]=availableLocales[i].toString(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                            
                                            
    5
    return dbObjects;
    Preondition Violations
    Unmatched return dbObjects;
    5
    return dbObjects;
    5
    return result;
    5
    return result;
    Preondition Violations
    Unmatched return result;
                                      
    Precondition Violations (9)
    Row Violation
    1Type int of variable availableLocales.length does not match with type int of variable nodes.length
    2Type int of variable availableLocales.length does not match with type int of variable nodes.length
    3Type java.util.Locale[] of variable availableLocales does not match with type int of variable nodes.length
    4Type int of variable availableLocales.length does not match with type net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode[] of variable nodes
    5Unmatched statement dbObjects[i]=nodes[i].getDatabaseObjectInfo(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement result[i]=availableLocales[i].toString(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched return dbObjects;
    8Unmatched return result;
    9The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero