for (EStructuralFeature feature : getAnyChildrenFeatures(eObject))
{
if (feature == childFeature)
{
break;
}
if (feature.isMany())
{
index -= ((List<?>)(eObject).eGet(feature)).size();
}
else if (eObject.eGet(feature) != null)
{
index -= 1;
}
}
for (EStructuralFeature feature : getAnyChildrenFeatures(eObject))
{
if (feature == childFeature)
{
break;
}
if (feature.isMany())
{
index -= ((List<?>)(eObject).eGet(feature)).size();
}
else if (eObject.eGet(feature) != null)
{
index -= 1;
}
}
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/edit/provider/ItemProviderAdapter.java
|
|
File path: /emf-2.4.1/src/org/eclipse/emf/edit/provider/ItemProviderAdapter.java
|
Method name: Command factorAddCommand(EditingDomain, CommandParameter)
|
|
Method name: Command factorMoveCommand(EditingDomain, CommandParameter)
|
Number of AST nodes: 7
|
|
Number of AST nodes: 7
|
|
1 | for (EStructuralFeature feature : getAnyChildrenFeatures(eObject))↵ | | 1 | for (EStructuralFeature feature : getAnyChildrenFeatures(eObject))↵
|
2 | {↵ | | 2 | ↵
|
3 | ↵ | | 3 | {↵
|
4 | if (feature == childFeature)↵ | | 4 | if (feature == childFeature)↵
|
5 | {↵ | | 5 | ↵
|
6 | ↵ | | 6 | {↵
|
7 | break;↵ | | 7 | break;↵
|
8 | } ↵ | | 8 | } ↵
|
|
9 | if (feature.isMany())↵ | | 9 | if (feature.isMany())↵
|
10 | {↵ | | 10 | {↵
|
11 | index -= ((List<?>)(eObject).eGet(feature)).size();↵ | | 11 | index -= ((List<?>)(eObject).eGet(feature)).size();↵
|
12 | }↵ | | 12 | ↵
|
13 | ↵ | | 13 | }↵
|
14 | else if (eObject.eGet(feature) != null)↵ | | 14 | else if (eObject.eGet(feature) != null)↵
|
15 | {↵ | | 15 | ↵
|
16 | ↵ | | 16 | {↵
|
17 | index -= 1;↵ | | 17 | index -= 1;↵
|
18 | }↵ | | 18 | ↵
|
19 | ↵ | | 19 | }↵
|
20 | } | | 20 | }
|
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.8 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 30 |
-
{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) | 1.9 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
15 | for (EStructuralFeature feature : getAnyChildrenFeatures(eObject)) | | 6 | for (EStructuralFeature feature : getAnyChildrenFeatures(eObject)) |
16 | if (feature == childFeature) | | 7 | if (feature == childFeature) |
17 | | | 8 | |
18 | | | 9 | |
19 | index -= ((List<?>)(eObject).eGet(feature)).size(); | | 10 | index -= ((List<?>)(eObject).eGet(feature)).size(); |
20 | else if (eObject.eGet(feature) != null) | | 11 | else if (eObject.eGet(feature) != null) |
21 | | | 12 | |
Precondition Violations (0)
Row |
Violation |