Index index = (Index) indexes.get( indexName ); if ( index == null ) { index = new Index(); index.setName( indexName ); index.setTable( this ); indexes.put( indexName, index ); } return index;
UniqueKey uk = (UniqueKey) uniqueKeys.get( keyName ); if ( uk == null ) { uk = new UniqueKey(); uk.setName( keyName ); uk.setTable( this ); uniqueKeys.put( keyName, uk ); } return uk;
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: Index getOrCreateIndex(String) Method name: UniqueKey getOrCreateUniqueKey(String)
Number of AST nodes: 7 Number of AST nodes: 7
1
Index index = (Index) indexes.get( indexName );
1
UniqueKey uk = (UniqueKey) uniqueKeys.get( keyName );
2
		if ( index == null ) {
2
		if ( uk == null ) {
3
			index = new Index();
3
			uk = new UniqueKey();
4
			index.setName( indexName );
4
			uk.setName( keyName );
5
			index.setTable( this );
5
			uk.setTable( this );
6
			indexes.put( indexName, index );
6
			uniqueKeys.put( keyName, uk );
7
		}
7
		}
8
		return index;
8
		return uk;
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.2
Clones locationClones are declared in the same class
Number of node comparisons29
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)16.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Index index = (Index)indexes.get(indexName);
    1
    Index index = (Index)indexes.get(indexName);
    1
    UniqueKey uk = (UniqueKey)uniqueKeys.get(keyName);
    Differences
    Expression1Expression2Difference
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    indexukVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    indexNamekeyNameVARIABLE_NAME_MISMATCH
    indexesuniqueKeysVARIABLE_NAME_MISMATCH
    1
    UniqueKey uk = (UniqueKey)uniqueKeys.get(keyName);
    2
    if (index == null)
    2
    if (index == null)
    2
    if (uk == null)
    Differences
    Expression1Expression2Difference
    indexukVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    2
    if (uk == null)
    3
    index = new Index();
    3
    index = new Index();
    3
    uk = new UniqueKey();
    Differences
    Expression1Expression2Difference
    indexukVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    3
    uk = new UniqueKey();
    4
    index.setName(indexName);
    4
    index.setName(indexName);
    4
    uk.setName(keyName);
    Differences
    Expression1Expression2Difference
    indexNamekeyNameVARIABLE_NAME_MISMATCH
    indexukVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression index cannot be unified with expression uk , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public void setName(java.lang.String)
    4
    uk.setName(keyName);
    5
    index.setTable(this);
    5
    index.setTable(this);
    5
    uk.setTable(this);
    Differences
    Expression1Expression2Difference
    indexukVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression index cannot be unified with expression uk , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public void setTable(org.hibernate.mapping.Table)
    5
    uk.setTable(this);
    6
    indexes.put(indexName, index);
    6
    indexes.put(indexName, index);
    6
    uniqueKeys.put(keyName, uk);
    Differences
    Expression1Expression2Difference
    indexNamekeyNameVARIABLE_NAME_MISMATCH
    indexukVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    indexesuniqueKeysVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression index cannot be unified with expression uk , because common superclass type org.hibernate.mapping.RelationalModel cannot be passed as an argument to public abstract java.lang.Object put(java.lang.Object, java.lang.Object)
    6
    uniqueKeys.put(keyName, uk);
    7
    return index;
    7
    return index;
    7
    return uk;
    Differences
    Expression1Expression2Difference
    indexukVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Indexorg.hibernate.mapping.UniqueKeySUBCLASS_TYPE_MISMATCH
    7
    return uk;
    Precondition Violations (3)
    Row Violation
    1Expression index cannot be unified with expression uk , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public void setName(java.lang.String)
    2Expression index cannot be unified with expression uk , because common superclass org.hibernate.mapping.RelationalModel does not declare member(s) public void setTable(org.hibernate.mapping.Table)
    3Expression index cannot be unified with expression uk , because common superclass type org.hibernate.mapping.RelationalModel cannot be passed as an argument to public abstract java.lang.Object put(java.lang.Object, java.lang.Object)