int count = 0;
for (InternalEObject parent = ((InternalEObject)eObject).eInternalContainer(); parent != null; parent = parent.eInternalContainer())
{
if (++count > 100000)
{
return getRootContainer(parent, false);
}
result = parent;
if (parent == eObject)
{
throw new IllegalStateException("There is a cycle in the containment hierarchy of " + eObject);
}
}
int count = 0;
for (EObject parent = eObject.eContainer(); parent != null; parent = parent.eContainer())
{
if (++count > 100000)
{
return getRootContainer(parent);
}
result = parent;
if (parent == eObject)
{
throw new IllegalStateException("There is a cycle in the containment hierarchy of " + eObject);
}
}
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: EObject getRootContainer(EObject, boolean)
|
|
Method name: EObject getRootContainer(EObject)
|
Number of AST nodes: 7
|
|
Number of AST nodes: 7
|
|
1 | int count = 0;↵ | | 1 | int count = 0;↵
|
2 | for (InternalEObject parent = ((InternalEObject)eObject).eInternalContainer(); parent != null; parent = parent.eInternalContainer())↵ | | 2 | for (EObject parent = eObject.eContainer(); parent != null; parent = parent.eContainer())↵
|
3 | {↵ | | 3 | {↵
|
4 | if (++count > 100000)↵ | | 4 | if (++count > 100000)↵
|
5 | {↵ | | 5 | {↵
|
6 | return getRootContainer(parent, false);↵ | | 6 | return getRootContainer(parent);↵
|
7 | }↵ | | 7 | }↵
|
8 | result = parent;↵ | | 8 | result = parent;↵
|
9 | if (parent == eObject)↵ | | 9 | if (parent == eObject)↵
|
10 | {↵ | | 10 | ↵
|
11 | ↵ | | 11 | {↵
|
12 | throw new IllegalStateException("There is a cycle in the containment hierarchy of " + eObject);↵ | | 12 | throw new IllegalStateException("There is a cycle in the containment hierarchy of " + eObject);↵
|
13 | }↵ | | 13 | ↵
|
14 | ↵ | | 14 | }↵
|
15 | } | | 15 | }
|
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 15 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.7 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
7 | if (++count > 100000) | | 5 | if (++count > 100000) |
8 | return getRootContainer(parent, false); | | 6 | return getRootContainer(parent); |
| | | 7 | result = parent; |
9 | result = parent; | | | |
10 | if (parent == eObject) | | 8 | if (parent == eObject) |
11 | throw new IllegalStateException("There is a cycle in the containment hierarchy of " + eObject); | | 9 | throw new IllegalStateException("There is a cycle in the containment hierarchy of " + eObject); |
Precondition Violations (1)
Row |
Violation |
1 | Type org.eclipse.emf.ecore.InternalEObject of variable parent does not match with type org.eclipse.emf.ecore.EObject of variable parent |