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: 13 | Number of AST nodes: 13 | |||
1 | EStructuralFeature entryFeature = object.getEStructuralFeature();↵ | 1 | EStructuralFeature entryFeature = object.getEStructuralFeature();↵ | |
2 | if (isMany(entryFeature))↵ | 2 | if (isMany(entryFeature))↵ | |
3 | {↵ | 3 | {↵ | |
4 | if (entryFeature.isUnique())↵ | 4 | if (entryFeature.isUnique())↵ | |
5 | {↵ | 5 | {↵ | |
6 | for (int i = 0, size = delegateSize(); i < size; ++i)↵ | 6 | for (int i = 0, size = delegateSize(); i < size; ++i)↵ | |
7 | {↵ | 7 | {↵ | |
8 | Entry otherEntry = delegateGet(i);↵ | 8 | Entry otherEntry = delegateGet(i);↵ | |
9 | if (otherEntry.equals(object) && i != index)↵ | 9 | if (otherEntry.equals(object) && i != index)↵ | |
10 | {↵ | 10 | {↵ | |
11 | throw new IllegalArgumentException("The 'no duplicates' constraint is violated");↵ | 11 | throw new IllegalArgumentException("The 'no duplicates' constraint is violated");↵ | |
12 | }↵ | 12 | }↵ | |
13 | }↵ | 13 | }↵ | |
14 | }↵ | 14 | }↵ | |
15 | }↵ | 15 | }↵ | |
16 | else↵ | 16 | else↵ | |
17 | {↵ | 17 | {↵ | |
18 | FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), entryFeature);↵ | 18 | FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), entryFeature);↵ | |
19 | for (int i = 0, size = delegateSize(); i < size; ++i)↵ | 19 | for (int i = 0, size = delegateSize(); i < size; ++i)↵ | |
20 | {↵ | 20 | {↵ | |
21 | Entry otherEntry = delegateGet(i);↵ | 21 | Entry otherEntry = delegateGet(i);↵ | |
22 | if (validator.isValid(otherEntry.getEStructuralFeature()) && i != index)↵ | 22 | if (validator.isValid(otherEntry.getEStructuralFeature()))↵ | |
23 | {↵ | 23 | {↵ | |
24 | throw new IllegalArgumentException("The multiplicity constraint is violated");↵ | 24 | throw new IllegalArgumentException("The multiplicity constraint is violated");↵ | |
25 | }↵ | 25 | }↵ | |
26 | }↵ | 26 | }↵ | |
27 | }↵ | 27 | }↵ | |
28 | return doSet(index, object); | 28 | doAdd(index, object); | |
See real code fragment | See real code fragment |
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) | 1.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 20 |
Number of mapped statements | 8 |
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.3 |
Clone type | Type 1 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
1 | EStructuralFeature entryFeature = object.getEStructuralFeature(); | 1 | EStructuralFeature entryFeature = object.getEStructuralFeature(); | |
2 | if (isMany(entryFeature)) | 2 | if (isMany(entryFeature)) | |
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"); |
Row | Violation |
---|