File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicFeatureMap.java | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicFeatureMap.java | |||
Method name: void add(int, Entry)
|
Method name: Entry set(int, Entry)
|
|||
Number of AST nodes: 16 | Number of AST nodes: 16 | |||
1 | Entry entry = object;↵ | 1 | Entry entry = object;↵ | |
2 | EStructuralFeature entryFeature = entry.getEStructuralFeature();↵ | 2 | EStructuralFeature entryFeature = entry.getEStructuralFeature();↵ | |
3 | if (isMany(entryFeature))↵ | 3 | if (isMany(entryFeature))↵ | |
4 | {↵ | 4 | {↵ | |
5 | if (entryFeature.isUnique())↵ | 5 | if (entryFeature.isUnique())↵ | |
6 | {↵ | 6 | {↵ | |
7 | Entry [] entries = (Entry[])data;↵ | 7 | Entry [] entries = (Entry[])data;↵ | |
8 | for (int i = 0; i < size; ++i)↵ | 8 | for (int i = 0; i < size; ++i)↵ | |
9 | {↵ | 9 | {↵ | |
10 | Entry otherEntry = entries[i];↵ | 10 | Entry otherEntry = entries[i];↵ | |
11 | if (otherEntry.equals(entry) && i != index)↵ | 11 | if (otherEntry.equals(entry) && i != index)↵ | |
12 | {↵ | 12 | {↵ | |
13 | throw new IllegalArgumentException("The 'no duplicates' constraint is violated");↵ | 13 | throw new IllegalArgumentException("The 'no duplicates' constraint is violated");↵ | |
14 | }↵ | 14 | }↵ | |
15 | }↵ | 15 | }↵ | |
16 | }↵ | 16 | }↵ | |
17 | }↵ | 17 | }↵ | |
18 | else↵ | 18 | else↵ | |
19 | {↵ | 19 | {↵ | |
20 | FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), entryFeature);↵ | 20 | FeatureMapUtil.Validator validator = FeatureMapUtil.getValidator(owner.eClass(), entryFeature);↵ | |
21 | Entry [] entries = (Entry[])data;↵ | 21 | Entry [] entries = (Entry[])data;↵ | |
22 | for (int i = 0; i < size; ++i)↵ | 22 | for (int i = 0; i < size; ++i)↵ | |
23 | {↵ | 23 | {↵ | |
24 | Entry otherEntry = entries[i];↵ | 24 | Entry otherEntry = entries[i];↵ | |
25 | if (validator.isValid(otherEntry.getEStructuralFeature()))↵ | 25 | if (validator.isValid(otherEntry.getEStructuralFeature()) && i != index)↵ | |
26 | {↵ | 26 | {↵ | |
27 | throw new IllegalArgumentException("The multiplicity constraint is violated");↵ | 27 | throw new IllegalArgumentException("The multiplicity constraint is violated");↵ | |
28 | }↵ | 28 | }↵ | |
29 | }↵ | 29 | }↵ | |
30 | }↵ | 30 | }↵ | |
31 | doAdd(index, object); | 31 | return doSet(index, object); | |
See real code fragment | See real code fragment |
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) | 1.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 31 |
Number of mapped statements | 11 |
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 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
1 | Entry entry = object; | 1 | Entry entry = object; | |
2 | EStructuralFeature entryFeature = entry.getEStructuralFeature(); | 2 | EStructuralFeature entryFeature = entry.getEStructuralFeature(); | |
3 | if (isMany(entryFeature)) | 3 | if (isMany(entryFeature)) | |
4 | if (entryFeature.isUnique()) | 4 | if (entryFeature.isUnique()) | |
5 | Entry[] entries = (Entry[])data; | 5 | Entry[] entries = (Entry[])data; | |
6 | for (int i = 0; i < size; ++i) | 6 | for (int i = 0; i < size; ++i) | |
7 | Entry otherEntry = entries[i]; | 7 | Entry otherEntry = entries[i]; | |
8 | if (otherEntry.equals(entry) && i != index) | 8 | if (otherEntry.equals(entry) && i != index) | |
9 | throw new IllegalArgumentException("The 'no duplicates' constraint is violated"); | 9 | throw new IllegalArgumentException("The 'no duplicates' constraint is violated"); |
Row | Violation |
---|---|
1 | Clone fragment #1 returns variables entries, validator , while Clone fragment #2 returns variables entries, validator |