if ( uk == null ) { uk = new UniqueKey(); uk.setName( keyName ); uk.setTable( this ); uniqueKeys.put( keyName, uk ); }
if ( index == null ) { index = new Index(); index.setName( indexName ); index.setTable( this ); indexes.put( indexName, index ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/mapping/Table.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/mapping/Table.java
Method name: UniqueKey getOrCreateUniqueKey(String) Method name: Index getOrCreateIndex(String)
Number of AST nodes: 5 Number of AST nodes: 5
1
if ( uk == null ) {
1
if ( index == null ) {
2
			uk = new UniqueKey();
2
			index = new Index();
3
			uk.setName( keyName );
3
			index.setName( indexName );
4
			uk.setTable( this );
4
			index.setTable( this );
5
			uniqueKeys.put( keyName, uk );
5
			indexes.put( indexName, index );
6
		}
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.1
Clones locationClones are declared in the same class
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    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
    2
    if (uk == null)
    2
    if (uk == null)
    2
    if (index == null)
    Differences
    Expression1Expression2Difference
    ukindexVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.UniqueKeyorg.hibernate.mapping.IndexVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index
    • Make classes org.hibernate.mapping.UniqueKey and org.hibernate.mapping.Index extend a common superclass
    2
    if (index == null)
                                              
    3
    index = new Index();
    Preondition Violations
    Unmatched statement index=new Index(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    index = new Index();
    3
    uk = new UniqueKey();
    3
    uk = new UniqueKey();
    Preondition Violations
    Unmatched statement uk=new UniqueKey(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                
    4
    uk.setName(keyName);
    4
    uk.setName(keyName);
    4
    index.setName(indexName);
    Differences
    Expression1Expression2Difference
    keyNameindexNameVARIABLE_NAME_MISMATCH
    ukindexVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.UniqueKeyorg.hibernate.mapping.IndexVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index
    • Make classes org.hibernate.mapping.UniqueKey and org.hibernate.mapping.Index extend a common superclass
    4
    index.setName(indexName);
    5
    uk.setTable(this);
    5
    uk.setTable(this);
    5
    index.setTable(this);
    Differences
    Expression1Expression2Difference
    ukindexVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.UniqueKeyorg.hibernate.mapping.IndexVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index
    • Make classes org.hibernate.mapping.UniqueKey and org.hibernate.mapping.Index extend a common superclass
    5
    index.setTable(this);
    6
    uniqueKeys.put(keyName, uk);
    6
    uniqueKeys.put(keyName, uk);
    6
    indexes.put(indexName, index);
    Differences
    Expression1Expression2Difference
    keyNameindexNameVARIABLE_NAME_MISMATCH
    ukindexVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.UniqueKeyorg.hibernate.mapping.IndexVARIABLE_TYPE_MISMATCH
    uniqueKeysindexesVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index
    • Make classes org.hibernate.mapping.UniqueKey and org.hibernate.mapping.Index extend a common superclass
    6
    indexes.put(indexName, index);
    Precondition Violations (6)
    Row Violation
    1Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index
    2Unmatched statement index=new Index(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement uk=new UniqueKey(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index
    5Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index
    6Type org.hibernate.mapping.UniqueKey of variable uk does not match with type org.hibernate.mapping.Index of variable index