if (entryFeature.isUnique())
{
for (int i = 0, size = delegateSize(); i < size; ++i)
{
Entry otherEntry = delegateGet(i);
if (otherEntry.equals(object) && i != index)
{
throw new IllegalArgumentException("The 'no duplicates' constraint is violated");
}
}
}
if (entryFeature.isUnique())
{
for (int i = 0, size = delegateSize(); i < size; ++i)
{
Entry otherEntry = delegateGet(i);
if (otherEntry.equals(object) && i != index)
{
throw new IllegalArgumentException("The 'no duplicates' constraint is violated");
}
}
}
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/DelegatingFeatureMap.java
|
|
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/DelegatingFeatureMap.java
|
Method name: Entry set(int, Entry)
|
|
Method name: void add(int, Entry)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | if (entryFeature.isUnique())↵ | | 1 | if (entryFeature.isUnique())↵
|
2 | {↵ | | 2 | {↵
|
3 | for (int i = 0, size = delegateSize(); i < size; ++i)↵ | | 3 | for (int i = 0, size = delegateSize(); i < size; ++i)↵
|
4 | {↵ | | 4 | {↵
|
5 | Entry otherEntry = delegateGet(i);↵ | | 5 | Entry otherEntry = delegateGet(i);↵
|
6 | if (otherEntry.equals(object) && i != index)↵ | | 6 | if (otherEntry.equals(object) && i != index)↵
|
7 | {↵ | | 7 | {↵
|
8 | throw new IllegalArgumentException("The 'no duplicates' constraint is violated");↵ | | 8 | throw new IllegalArgumentException("The 'no duplicates' constraint is violated");↵
|
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 | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.7 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 10 |
-
{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.6 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | if (entryFeature.isUnique()) | | 3 | if (entryFeature.isUnique()) |
4 | for (int i = 0, size = delegateSize(); i < size; ++i) | | 4 | for (int i = 0, size = delegateSize(); i < size; ++i) |
5 | Entry otherEntry = delegateGet(i); | | 5 | Entry otherEntry = delegateGet(i); |
6 | if (otherEntry.equals(object) && i != index) | | 6 | if (otherEntry.equals(object) && i != index) |
7 | throw new IllegalArgumentException("The 'no duplicates' constraint is violated"); | | 7 | throw new IllegalArgumentException("The 'no duplicates' constraint is violated"); |
Precondition Violations (0)
Row |
Violation |