StringBuffer buf = new StringBuffer( " index (" );
Iterator iter = getColumnIterator();
while ( iter.hasNext() ) {
buf.append( ( (Column) iter.next() ).getQuotedName( dialect ) );
if ( iter.hasNext() ) buf.append( ", " );
}
return buf.append( ')' ).toString();
StringBuffer buf = new StringBuffer("primary key (");
Iterator iter = getColumnIterator();
while ( iter.hasNext() ) {
buf.append( ( (Column) iter.next() ).getQuotedName(dialect) );
if ( iter.hasNext() ) buf.append(", ");
}
return buf.append(')').toString();
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/mapping/Index.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/mapping/PrimaryKey.java
|
Method name: String sqlConstraintString(Dialect)
|
|
Method name: String sqlConstraintString(Dialect)
|
Number of AST nodes: 7
|
|
Number of AST nodes: 7
|
|
1 | StringBuffer buf = new StringBuffer( " index (" );↵ | | 1 | StringBuffer buf = new StringBuffer("primary key (");↵
|
2 | Iterator iter = getColumnIterator();↵ | | 2 | Iterator iter = getColumnIterator();↵
|
3 | while ( iter.hasNext() ) {↵ | | 3 | while ( iter.hasNext() ) {↵
|
4 | buf.append( ( (Column) iter.next() ).getQuotedName( dialect ) );↵ | | 4 | buf.append( ( (Column) iter.next() ).getQuotedName(dialect) );↵
|
5 | if ( iter.hasNext() ) buf.append( ", " );↵ | | 5 | if ( iter.hasNext() ) buf.append(", ");↵
|
6 | }↵ | | 6 | }↵
|
7 | return buf.append( ')' ).toString(); | | 7 | return buf.append(')').toString();
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are in different classes |
Number of node comparisons | 13 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 7 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 6.8 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | StringBuffer buf = new StringBuffer(" index ("); | | 1 | StringBuffer buf = new StringBuffer("primary key ("); |
2 | Iterator iter = getColumnIterator(); | | 2 | Iterator iter = getColumnIterator(); |
3 | while (iter.hasNext()) | | 3 | while (iter.hasNext()) |
4 | buf.append(((Column)iter.next()).getQuotedName(dialect)); | | 4 | buf.append(((Column)iter.next()).getQuotedName(dialect)); |
5 | | | 5 | |
6 | | | 6 | |
7 | return buf.append(')').toString(); | | 7 | return buf.append(')').toString(); |
Precondition Violations (1)
Row |
Violation |
1 | The refactoring of the clones is infeasible, because classes org.hibernate.mapping.Index and org.hibernate.mapping.PrimaryKey do not have a common superclass |