ResourceSet resourceSet = resource.getResourceSet();
if (resourceSet != null)
{
AdapterFactory factory = getAdapterFactory(resourceSet.getAdapterFactories(), type);
if (factory != null)
{
result = factory.adaptNew(eObject, type);
}
}
ResourceSet resourceSet = resource.getResourceSet();
if (resourceSet != null)
{
AdapterFactory factory = getAdapterFactory(resourceSet.getAdapterFactories(), type);
if (factory != null)
{
result = factory.adaptNew(resource, type);
}
}
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/EcoreUtil.java
|
|
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/EcoreUtil.java
|
Method name: Adapter getRegisteredAdapter(EObject, Object)
|
|
Method name: Adapter getRegisteredAdapter(Resource, Object)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | ResourceSet resourceSet = resource.getResourceSet();↵ | | 1 | ResourceSet resourceSet = resource.getResourceSet();↵
|
2 | if (resourceSet != null)↵ | | 2 | if (resourceSet != null)↵
|
3 | {↵ | | 3 | ↵
|
4 | ↵ | | 4 | {↵
|
5 | AdapterFactory factory = getAdapterFactory(resourceSet.getAdapterFactories(), type);↵ | | 5 | AdapterFactory factory = getAdapterFactory(resourceSet.getAdapterFactories(), type);↵
|
6 | if (factory != null)↵ | | 6 | if (factory != null)↵
|
7 | {↵ | | 7 | {↵
|
8 | result = factory.adaptNew(eObject, type);↵ | | 8 | result = factory.adaptNew(resource, type);↵
|
9 | }↵ | | 9 | ↵
|
10 | ↵ | | 10 | }↵
|
11 | } | | 11 | }
|
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.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 10 |
-
{Non-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.9 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
5 | ResourceSet resourceSet = resource.getResourceSet(); | | 3 | ResourceSet resourceSet = resource.getResourceSet(); |
6 | if (resourceSet != null) | | 4 | if (resourceSet != null) |
7 | AdapterFactory factory = getAdapterFactory(resourceSet.getAdapterFactories(), type); | | 5 | AdapterFactory factory = getAdapterFactory(resourceSet.getAdapterFactories(), type); |
8 | | | 6 | |
9 | result = factory.adaptNew(eObject, type); | | 7 | result = factory.adaptNew(resource, type); |
Precondition Violations (1)
Row |
Violation |
1 | Type org.eclipse.emf.ecore.EObject of variable eObject does not match with type org.eclipse.emf.ecore.resource.Resource of variable resource |