Index parentIndex = (Index) iter.next(); Index index = new Index(); index.setName( getName() + parentIndex.getName() ); index.setTable(this); index.addColumns( parentIndex.getColumnIterator() ); indexes.add( index );
PrimaryKey pk = new PrimaryKey(); Table table = getTable(); pk.setTable(table); pk.setName( PK_ALIAS.toAliasString( table.getName() ) ); table.setPrimaryKey(pk); pk.addColumns( getKey().getColumnIterator() );
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/mapping/DenormalizedTable.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/mapping/PersistentClass.java
Method name: Iterator getIndexIterator() Method name: void createPrimaryKey()
Number of AST nodes: 6 Number of AST nodes: 6
1
Index parentIndex = (Index) iter.next();
2
			Index index = new Index();
3
			index.setName( getName() + parentIndex
1
PrimaryKey pk = new PrimaryKey();
2
		Table table = getTable();
3
		pk.setTable(table);
4
.getName() );
4
		pk.setName( PK_ALIAS.toAliasString( table.getName() ) );
5
			index.setTable(this);
5
		table.setPrimaryKey(pk);
6
			index.addColumns( parentIndex.getColumnIterator() );
6
		pk.addColumns( getKey().getColumnIterator() );
7
			indexes.add( index );
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.0
Clones locationClones are in different classes
Number of node comparisons24
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    Index parentIndex = (Index)iter.next();
    4
    Index parentIndex = (Index)iter.next();
    2
    Table table = getTable();
    Differences
    Expression1Expression2Difference
    org.hibernate.mapping.Indexorg.hibernate.mapping.TableSUBCLASS_TYPE_MISMATCH
    parentIndextableVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.TableSUBCLASS_TYPE_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.TableSUBCLASS_TYPE_MISMATCH
    (Index)iter.next()getTable()TYPE_COMPATIBLE_REPLACEMENT
    2
    Table table = getTable();
    5
    Index index = new Index();
    5
    Index index = new Index();
    1
    PrimaryKey pk = new PrimaryKey();
    Differences
    Expression1Expression2Difference
    org.hibernate.mapping.Indexorg.hibernate.mapping.PrimaryKeySUBCLASS_TYPE_MISMATCH
    indexpkVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.PrimaryKeySUBCLASS_TYPE_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.PrimaryKeySUBCLASS_TYPE_MISMATCH
    1
    PrimaryKey pk = new PrimaryKey();
    6
    index.setName(getName() + parentIndex.getName());
    6
    index.setName(getName() + parentIndex.getName());
    4
    pk.setName(PK_ALIAS.toAliasString(table.getName()));
    Differences
    Expression1Expression2Difference
    getName() + parentIndex.getName()PK_ALIAS.toAliasString(table.getName())TYPE_COMPATIBLE_REPLACEMENT
    indexpkVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.PrimaryKeySUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression getName() + parentIndex.getName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression PK_ALIAS.toAliasString(table.getName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression index cannot be unified with expression pk , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public void setName(java.lang.String)
    4
    pk.setName(PK_ALIAS.toAliasString(table.getName()));
    7
    index.setTable(this);
    7
    index.setTable(this);
    3
    pk.setTable(table);
    Differences
    Expression1Expression2Difference
    thistableTYPE_COMPATIBLE_REPLACEMENT
    indexpkVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.PrimaryKeySUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression table cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression index cannot be unified with expression pk , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public void setTable(org.hibernate.mapping.Table)
    3
    pk.setTable(table);
                                                          
    5
    table.setPrimaryKey(pk);
    Preondition Violations
    Unmatched statement table.setPrimaryKey(pk); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    table.setPrimaryKey(pk);
                                                                                                  
    6
    pk.addColumns(getKey().getColumnIterator());
    Preondition Violations
    Unmatched statement pk.addColumns(getKey().getColumnIterator()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    pk.addColumns(getKey().getColumnIterator());
    8
    index.addColumns(parentIndex.getColumnIterator());
    8
    index.addColumns(parentIndex.getColumnIterator());
    Preondition Violations
    Unmatched statement index.addColumns(parentIndex.getColumnIterator()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                              
    9
    indexes.add(index);
    9
    indexes.add(index);
    Preondition Violations
    Unmatched statement indexes.add(index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                
    Precondition Violations (11)
    Row Violation
    1Expression getName() + parentIndex.getName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression PK_ALIAS.toAliasString(table.getName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression index cannot be unified with expression pk , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public void setName(java.lang.String)
    4Expression table cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression index cannot be unified with expression pk , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public void setTable(org.hibernate.mapping.Table)
    6Unmatched statement table.setPrimaryKey(pk); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement pk.addColumns(getKey().getColumnIterator()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement index.addColumns(parentIndex.getColumnIterator()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement indexes.add(index); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10Clone fragment #1 returns variables parentIndex, index , while Clone fragment #2 returns variables pk, table
    11The refactoring of the clones is infeasible, because classes org.hibernate.mapping.DenormalizedTable and org.hibernate.mapping.PersistentClass do not have a common superclass