Object obj = paths[i].getLastPathComponent(); if (obj instanceof ObjectTreeNode) { list.add((ObjectTreeNode)obj); }
for (int i = 0; i < _constraints.size(); i++) { MssqlConstraint constraint = _constraints.get(i); if (constraint instanceof ForeignKeyConstraint) { results.add((ForeignKeyConstraint)constraint); } }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree/ObjectTree.java File path: /sql12/plugins/mssql/src/net/sourceforge/squirrel_sql/plugins/mssql/sql/constraint/TableConstraints.java
Method name: ObjectTreeNode[] getSelectedNodes() Method name: List getForeignKeyConstraints()
Number of AST nodes: 3 Number of AST nodes: 4
1
Object obj = paths[i].getLastPathComponen
1
for (int i = 0; i < _constraints.size(); i++) {
2
t();
2
            MssqlConstraint constraint = _constraints.get(i);
3
				if (obj instanceof ObjectTreeNode)
4
				{
5
					list.add((ObjectTreeNode)obj);
6
				
3
            if (constraint instanceof ForeignKeyConstraint) {
4
                results.add((ForeignKeyConstraint)constraint);
5
            }
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)1.0
Clones locationClones are in different classes
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                        
    3
    MssqlConstraint constraint = _constraints.get(i);
    Preondition Violations
    Unmatched statement MssqlConstraint constraint=_constraints.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    MssqlConstraint constraint = _constraints.get(i);
    5
    Object obj = paths[i].getLastPathComponent();
    5
    Object obj = paths[i].getLastPathComponent();
    Preondition Violations
    Unmatched statement Object obj=paths[i].getLastPathComponent(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                
    6
    if (obj instanceof ObjectTreeNode)
    6
    if (obj instanceof ObjectTreeNode)
    4
    if (constraint instanceof ForeignKeyConstraint)
    Differences
    Expression1Expression2Difference
    objconstraintVARIABLE_NAME_MISMATCH
    java.lang.Objectnet.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraintVARIABLE_TYPE_MISMATCH
    net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNodenet.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.ForeignKeyConstraintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Object of variable obj does not match with type net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraint of variable constraint
    • Make classes java.lang.Object and net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraint extend a common superclass
    Expression obj instanceof ObjectTreeNode cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression constraint instanceof ForeignKeyConstraint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode does not match with type net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.ForeignKeyConstraint
    • Make classes net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode and net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.ForeignKeyConstraint extend a common superclass
    4
    if (constraint instanceof ForeignKeyConstraint)
    7
    list.add((ObjectTreeNode)obj);
    7
    list.add((ObjectTreeNode)obj);
    5
    results.add((ForeignKeyConstraint)constraint);
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNodenet.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.ForeignKeyConstraintVARIABLE_TYPE_MISMATCH
    objconstraintVARIABLE_NAME_MISMATCH
    java.lang.Objectnet.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraintVARIABLE_TYPE_MISMATCH
    listresultsVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.ArrayListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression (ObjectTreeNode)obj cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (ForeignKeyConstraint)constraint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode does not match with type net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.ForeignKeyConstraint
    • Make classes net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode and net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.ForeignKeyConstraint extend a common superclass
    Type java.lang.Object of variable obj does not match with type net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraint of variable constraint
    • Make classes java.lang.Object and net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraint extend a common superclass
    Type java.util.List<net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode> of variable list does not match with type java.util.ArrayList<net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.ForeignKeyConstraint> of variable results
    • Make classes java.util.List and java.util.ArrayList extend a common superclass
    5
    results.add((ForeignKeyConstraint)constraint);
    Precondition Violations (11)
    Row Violation
    1Unmatched statement MssqlConstraint constraint=_constraints.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement Object obj=paths[i].getLastPathComponent(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type java.lang.Object of variable obj does not match with type net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraint of variable constraint
    4Expression obj instanceof ObjectTreeNode cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression constraint instanceof ForeignKeyConstraint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode does not match with type net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.ForeignKeyConstraint
    7Expression (ObjectTreeNode)obj cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression (ForeignKeyConstraint)constraint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode does not match with type net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.ForeignKeyConstraint
    10Type java.lang.Object of variable obj does not match with type net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraint of variable constraint
    11Type java.util.List<net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode> of variable list does not match with type java.util.ArrayList<net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.ForeignKeyConstraint> of variable results