for (int i = 0; i < _constraints.size(); i++) { MssqlConstraint constraint = _constraints.get(i); if (constraint instanceof PrimaryKeyConstraint) { results.add((PrimaryKeyConstraint)constraint); } }
Object obj = paths[i].getLastPathComponent(); if (obj instanceof ObjectTreeNode) { list.add((ObjectTreeNode)obj); }
Clone fragments detected by clone detection tool
File path: /sql12/plugins/mssql/src/net/sourceforge/squirrel_sql/plugins/mssql/sql/constraint/TableConstraints.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree/ObjectTree.java
Method name: List getPrimaryKeyConstraints() Method name: ObjectTreeNode[] getSelectedNodes()
Number of AST nodes: 4 Number of AST nodes: 3
1
for (int i = 0; i < _constraints.size(); i++) {
2
            MssqlConstraint constraint = _constraints.get(i);
1
Object obj = paths[i].getLastPathComponent();
3
            if (constraint instanceof PrimaryKeyConstraint) {
4
                results.add((PrimaryKeyConstraint)constraint);
5
            }
6
        
2
				if (obj instanceof ObjectTreeNode)
3
				{
4
					list.add((ObjectTreeNode)obj);
7
}
5
				}
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.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    MssqlConstraint constraint = _constraints.get(i);
    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
                                                                                                        
                                                                                                
    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
    5
    Object obj = paths[i].getLastPathComponent();
    4
    if (constraint instanceof PrimaryKeyConstraint)
    4
    if (constraint instanceof PrimaryKeyConstraint)
    6
    if (obj instanceof ObjectTreeNode)
    Differences
    Expression1Expression2Difference
    constraintobjVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraintjava.lang.ObjectVARIABLE_TYPE_MISMATCH
    net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.PrimaryKeyConstraintnet.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNodeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraint of variable constraint does not match with type java.lang.Object of variable obj
    • Make classes net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraint and java.lang.Object extend a common superclass
    Expression constraint instanceof PrimaryKeyConstraint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression obj instanceof ObjectTreeNode cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.PrimaryKeyConstraint does not match with type net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode
    • Make classes net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.PrimaryKeyConstraint and net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode extend a common superclass
    6
    if (obj instanceof ObjectTreeNode)
    5
    results.add((PrimaryKeyConstraint)constraint);
    5
    results.add((PrimaryKeyConstraint)constraint);
    7
    list.add((ObjectTreeNode)obj);
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.PrimaryKeyConstraintnet.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNodeVARIABLE_TYPE_MISMATCH
    constraintobjVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraintjava.lang.ObjectVARIABLE_TYPE_MISMATCH
    resultslistVARIABLE_NAME_MISMATCH
    java.util.ArrayListjava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression (PrimaryKeyConstraint)constraint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (ObjectTreeNode)obj cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.PrimaryKeyConstraint does not match with type net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode
    • Make classes net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.PrimaryKeyConstraint and net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode extend a common superclass
    Type net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraint of variable constraint does not match with type java.lang.Object of variable obj
    • Make classes net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraint and java.lang.Object extend a common superclass
    Type java.util.ArrayList<net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.PrimaryKeyConstraint> of variable results does not match with type java.util.List<net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode> of variable list
    • Make classes java.util.ArrayList and java.util.List extend a common superclass
    7
    list.add((ObjectTreeNode)obj);
    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 net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraint of variable constraint does not match with type java.lang.Object of variable obj
    4Expression constraint instanceof PrimaryKeyConstraint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression obj instanceof ObjectTreeNode cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.PrimaryKeyConstraint does not match with type net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode
    7Expression (PrimaryKeyConstraint)constraint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression (ObjectTreeNode)obj cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.PrimaryKeyConstraint does not match with type net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode
    10Type net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.MssqlConstraint of variable constraint does not match with type java.lang.Object of variable obj
    11Type java.util.ArrayList<net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint.PrimaryKeyConstraint> of variable results does not match with type java.util.List<net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.ObjectTreeNode> of variable list