if ( Company.class.getName().equals( entityName ) ) {
return ProxyHelper.newCompanyProxy( id );
}
else if ( Address.class.getName().equals( entityName ) ) {
return ProxyHelper.newAddressProxy( id );
}
else {
throw new IllegalArgumentException( "unknown entity for instantiation [" + entityName + "]" );
}
if ( Company.class.getName().equals( entityName ) ) {
return ProxyHelper.newCompanyProxy( id );
}
else if ( Address.class.getName().equals( entityName ) ) {
return ProxyHelper.newAddressProxy( id );
}
else {
throw new IllegalArgumentException( "unknown entity for instantiation [" + entityName + "]" );
}
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer/MyEntityInstantiator.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/MyEntityInstantiator.java
|
Method name: Object instantiate(Serializable)
|
|
Method name: Object instantiate(Serializable)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | if ( Company.class.getName().equals( entityName ) ) {↵ | | 1 | if ( Company.class.getName().equals( entityName ) ) {↵
|
2 | return ProxyHelper.newCompanyProxy( id );↵ | | 2 | return ProxyHelper.newCompanyProxy( id );↵
|
3 | }↵ | | 3 | }↵
|
4 | else if ( Address.class.getName().equals( entityName ) ) {↵ | | 4 | else if ( Address.class.getName().equals( entityName ) ) {↵
|
5 | return ProxyHelper.newAddressProxy( id );↵ | | 5 | return ProxyHelper.newAddressProxy( id );↵
|
6 | }↵ | | 6 | }↵
|
7 | else {↵ | | 7 | else {↵
|
8 | throw new IllegalArgumentException( "unknown entity for instantiation [" + entityName + "]" );↵ | | 8 | throw new IllegalArgumentException( "unknown entity for instantiation [" + entityName + "]" );↵
|
9 | } | | 9 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are in different classes |
Number of node comparisons | 20 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 5 |
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) | 0.7 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
5 | else if (Company.class.getName().equals(entityName)) | | 5 | else if (Company.class.getName().equals(entityName)) |
6 | return ProxyHelper.newCompanyProxy(id); | | 6 | return ProxyHelper.newCompanyProxy(id); |
7 | else if (Address.class.getName().equals(entityName)) | | 7 | else if (Address.class.getName().equals(entityName)) |
8 | return ProxyHelper.newAddressProxy(id); | | 8 | return ProxyHelper.newAddressProxy(id); |
| | | | |
9 | throw new IllegalArgumentException("unknown entity for instantiation [" + entityName + "]"); | | 9 | throw new IllegalArgumentException("unknown entity for instantiation [" + entityName + "]"); |
Precondition Violations (0)
Row |
Violation |