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/DelegatingFeatureMap.java | |||
Method name: NotificationChain basicRemove(Object, NotificationChain)
|
Method name: NotificationChain basicRemove(Object, NotificationChain)
|
|||
Number of AST nodes: 20 | Number of AST nodes: 19 | |||
1 | if (object instanceof FeatureMap.Entry)↵ | 1 | if (object instanceof FeatureMap.Entry)↵ | |
2 | {↵ | 2 | {↵ | |
3 | return super.basicRemove(object, notifications);↵ | 3 | return super.basicRemove(object, notifications);↵ | |
4 | }↵ | 4 | }↵ | |
5 | else↵ | 5 | else↵ | |
6 | {↵ | 6 | {↵ | |
7 | Entry match = null;↵ | 7 | Entry match = null;↵ | |
8 | EStructuralFeature feature = null;↵ | 8 | EStructuralFeature feature = null;↵ | |
9 | Entry [] entries = (Entry[])data;↵ | 9 | ↵ | |
10 | for (int i = 0; i < size; ++i)↵ | 10 | for (int i = 0, size = delegateSize(); i < size; ++i)↵ | |
11 | {↵ | 11 | {↵ | |
12 | Entry entry = entries[i];↵ | 12 | Entry entry = delegateGet(i); ↵ | |
13 | if (object.equals(entry.getValue()))↵ | 13 | if (object.equals(entry.getValue()))↵ | |
14 | {↵ | 14 | {↵ | |
15 | feature = entry.getEStructuralFeature();↵ | 15 | feature = entry.getEStructuralFeature();↵ | |
16 | if (feature instanceof EReference && ((EReference)feature).isContainment())↵ | 16 | if (feature instanceof EReference && ((EReference)feature).isContainment())↵ | |
17 | {↵ | 17 | {↵ | |
18 | match = entry;↵ | 18 | match = entry;↵ | |
19 | break;↵ | 19 | break;↵ | |
20 | }↵ | 20 | }↵ | |
21 | }↵ | 21 | }↵ | |
22 | }↵ | 22 | }↵ | |
23 | if (match != null)↵ | 23 | if (match != null)↵ | |
24 | {↵ | 24 | {↵ | |
25 | if (isNotificationRequired())↵ | 25 | if (isNotificationRequired())↵ | |
26 | {↵ | 26 | {↵ | |
27 | @SuppressWarnings("null")↵ | 27 | @SuppressWarnings("null")↵ | |
28 | NotificationImpl notification =↵ | 28 | NotificationImpl notification =↵ | |
29 | feature.isMany() ?↵ | 29 | feature.isMany() ?↵ | |
30 | createNotification↵ | 30 | createNotification↵ | |
31 | (Notification.REMOVE,↵ | 31 | (Notification.REMOVE,↵ | |
32 | feature,↵ | 32 | feature,↵ | |
33 | object,↵ | 33 | object,↵ | |
34 | null,↵ | 34 | null,↵ | |
35 | indexOf(feature, object),↵ | 35 | indexOf(feature, object),↵ | |
36 | true) :↵ | 36 | true) :↵ | |
37 | createNotification↵ | 37 | createNotification↵ | |
38 | (feature.isUnsettable() ? Notification.UNSET : Notification.SET,↵ | 38 | (feature.isUnsettable() ? Notification.UNSET : Notification.SET,↵ | |
39 | feature,↵ | 39 | feature,↵ | |
40 | object,↵ | 40 | object,↵ | |
41 | feature.getDefaultValue(),↵ | 41 | feature.getDefaultValue(),↵ | |
42 | Notification.NO_INDEX,↵ | 42 | Notification.NO_INDEX,↵ | |
43 | true);↵ | 43 | true);↵ | |
44 | if (notifications != null)↵ | 44 | if (notifications != null)↵ | |
45 | {↵ | 45 | {↵ | |
46 | notifications.add(notification);↵ | 46 | notifications.add(notification);↵ | |
47 | }↵ | 47 | }↵ | |
48 | else↵ | 48 | else↵ | |
49 | {↵ | 49 | {↵ | |
50 | notifications = notification;↵ | 50 | notifications = notification;↵ | |
51 | }↵ | 51 | }↵ | |
52 | }↵ | 52 | }↵ | |
53 | notifications = basicRemove(match, notifications);↵ | 53 | notifications = basicRemove(match, notifications);↵ | |
54 | }↵ | 54 | }↵ | |
55 | return notifications;↵ | 55 | return notifications;↵ | |
56 | } | 56 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 2 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 2 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 1.1 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 64 |
Number of mapped statements | 6 |
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.2 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7 | Entry entry = entries[i]; |
| 6 | Entry entry = delegateGet(i); | ||||||||||
8 | if (object.equals(entry.getValue())) | 7 | if (object.equals(entry.getValue())) | |||||||||||
9 | feature = entry.getEStructuralFeature(); | 8 | feature = entry.getEStructuralFeature(); | |||||||||||
10 | if (feature instanceof EReference && ((EReference)feature).isContainment()) | 9 | if (feature instanceof EReference && ((EReference)feature).isContainment()) | |||||||||||
11 | match = entry; | 10 | match = entry; | |||||||||||
12 | break; |
| 11 | break; |
Row | Violation |
---|---|
1 | Statement break; without innermost loop |
2 | Statement break; without innermost loop |
3 | Clone fragment #1 returns variables match, feature , while Clone fragment #2 returns variables match, feature |
Number of mapped statements | 12 |
Number of unmapped statements in the first code fragment | 8 |
Number of unmapped statements in the second code fragment | 7 |
Time elapsed for statement mapping (ms) | 4.2 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||
---|---|---|---|---|---|---|---|
1 | if (object instanceof FeatureMap.Entry) | 1 | if (object instanceof FeatureMap.Entry) | ||||
2 | return super.basicRemove(object, notifications); | 2 | return super.basicRemove(object, notifications); | ||||
else | else | ||||||
3 | Entry match = null; | 3 | Entry match = null; | ||||
4 | EStructuralFeature feature = null; | 4 | EStructuralFeature feature = null; | ||||
| 5 | for (int i = 0, size = delegateSize(); i < size; ++i) | |||||
| 6 | Entry entry = delegateGet(i); | |||||
|
| 7 | if (object.equals(entry.getValue())) | ||||
|
| 8 | feature = entry.getEStructuralFeature(); | ||||
| 9 | if (feature instanceof EReference && ((EReference)feature).isContainment()) | |||||
|
| 10 | match = entry; | ||||
|
| 11 | break; | ||||
5 | Entry[] entries = (Entry[])data; | | |||||
6 | for (int i = 0; i < size; ++i) | | |||||
7 | Entry entry = entries[i]; | | |||||
8 | if (object.equals(entry.getValue())) |
| | ||||
9 | feature = entry.getEStructuralFeature(); |
| | ||||
10 | if (feature instanceof EReference && ((EReference)feature).isContainment()) | | |||||
11 | match = entry; |
| | ||||
12 | break; |
| | ||||
13 | if (match != null) | 12 | if (match != null) | ||||
14 | if (isNotificationRequired()) | 13 | if (isNotificationRequired()) | ||||
15 | @SuppressWarnings("null") NotificationImpl notification = feature.isMany() ? createNotification(Notification.REMOVE, feature, object, null, indexOf(feature, object), true) : createNotification(feature.isUnsettable() ? Notification.UNSET : Notification.SET, feature, object, feature.getDefaultValue(), Notification.NO_INDEX, true); | 14 | @SuppressWarnings("null") NotificationImpl notification = feature.isMany() ? createNotification(Notification.REMOVE, feature, object, null, indexOf(feature, object), true) : createNotification(feature.isUnsettable() ? Notification.UNSET : Notification.SET, feature, object, feature.getDefaultValue(), Notification.NO_INDEX, true); | ||||
16 | if (notifications != null) | 15 | if (notifications != null) | ||||
17 | notifications.add(notification); | 16 | notifications.add(notification); | ||||
else | else | ||||||
18 | notifications = notification; | 17 | notifications = notification; | ||||
19 | notifications = basicRemove(match, notifications); | 18 | notifications = basicRemove(match, notifications); | ||||
20 | return notifications; | 19 | return notifications; |
Row | Violation |
---|---|
1 | Unmatched statement if(object.equals(entry.getValue())) cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement feature=entry.getEStructuralFeature(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement match=entry; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched break; |
5 | Unmatched statement if(object.equals(entry.getValue())) cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
6 | Unmatched statement feature=entry.getEStructuralFeature(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
7 | Unmatched statement match=entry; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
8 | Unmatched break; |
9 | Clone fragment #1 returns variables feature, match , while Clone fragment #2 returns variables feature, match |