File path: /emf-2.4.1/src/org/eclipse/emf/common/notify/impl/DelegatingNotifyingListImpl.java | File path: /emf-2.4.1/src/org/eclipse/emf/common/notify/impl/NotifyingListImpl.java | |||
Method name: boolean addAllUnique(int, Object[], int, int)
|
Method name: boolean addAllUnique(int, Object[], int, int)
|
|||
Number of AST nodes: 23 | Number of AST nodes: 23 | |||
1 | boolean oldIsSet = isSet();↵ | 1 | boolean oldIsSet = isSet();↵ | |
2 | doAddAllUnique(index, objects, start, end);↵ | 2 | doAddAllUnique(index, objects, start, end);↵ | |
3 | NotificationImpl notification;↵ | 3 | NotificationImpl notification;↵ | |
4 | if (collectionSize == 1)↵ | 4 | if (collectionSize == 1)↵ | |
5 | {↵ | 5 | {↵ | |
6 | notification = createNotification(Notification.ADD, null, objects[0], index, oldIsSet);↵ | 6 | notification = createNotification(Notification.ADD, null, objects[0], index, oldIsSet);↵ | |
7 | }↵ | 7 | }↵ | |
8 | else↵ | 8 | else↵ | |
9 | {↵ | 9 | {↵ | |
10 | if (start != 0 || end != objects.length)↵ | 10 | if (start != 0 || end != objects.length)↵ | |
11 | {↵ | 11 | {↵ | |
12 | Object [] actualObjects = new Object [collectionSize];↵ | 12 | Object [] actualObjects = new Object [collectionSize];↵ | |
13 | for (int i = 0, j = start; j < end; ++i, ++j)↵ | 13 | for (int i = 0, j = start; j < end; ++i, ++j)↵ | |
14 | {↵ | 14 | {↵ | |
15 | actualObjects[i] = objects[j];↵ | 15 | actualObjects[i] = objects[j];↵ | |
16 | }↵ | 16 | }↵ | |
17 | notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(actualObjects), index, oldIsSet);↵ | 17 | notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(actualObjects), index, oldIsSet);↵ | |
18 | }↵ | 18 | }↵ | |
19 | else↵ | 19 | else↵ | |
20 | {↵ | 20 | {↵ | |
21 | notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(objects), index, oldIsSet);↵ | 21 | notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(objects), index, oldIsSet);↵ | |
22 | }↵ | 22 | }↵ | |
23 | }↵ | 23 | }↵ | |
24 | if (hasInverse())↵ | 24 | if (hasInverse())↵ | |
25 | {↵ | 25 | {↵ | |
26 | NotificationChain notifications = createNotificationChain(collectionSize);↵ | 26 | NotificationChain notifications = createNotificationChain(collectionSize);↵ | |
27 | int lastIndex = index + collectionSize;↵ | 27 | int lastIndex = index + collectionSize;↵ | |
28 | for (int i = index; i < lastIndex; ++i)↵ | 28 | for (int i = index; i < lastIndex; ++i)↵ | |
29 | { ↵ | 29 | { ↵ | |
30 | E value = delegateGet(i);↵ | 30 | @SuppressWarnings("unchecked") E value = (E)data[i];↵ | |
31 | notifications = inverseAdd(value, notifications);↵ | 31 | notifications = inverseAdd(value, notifications);↵ | |
32 | notifications = shadowAdd(value, notifications);↵ | 32 | notifications = shadowAdd(value, notifications);↵ | |
33 | }↵ | 33 | }↵ | |
34 | if (notifications == null)↵ | 34 | if (notifications == null)↵ | |
35 | {↵ | 35 | {↵ | |
36 | dispatchNotification(notification);↵ | 36 | dispatchNotification(notification);↵ | |
37 | }↵ | 37 | }↵ | |
38 | else↵ | 38 | else↵ | |
39 | {↵ | 39 | {↵ | |
40 | notifications.add(notification);↵ | 40 | notifications.add(notification);↵ | |
41 | notifications.dispatch();↵ | 41 | notifications.dispatch();↵ | |
42 | }↵ | 42 | }↵ | |
43 | }↵ | 43 | }↵ | |
44 | else↵ | 44 | else↵ | |
45 | {↵ | 45 | {↵ | |
46 | dispatchNotification(notification);↵ | 46 | dispatchNotification(notification);↵ | |
47 | } | 47 |
| |
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.1 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 105 |
Number of mapped statements | 22 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 5.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||
---|---|---|---|---|---|---|---|
5 | boolean oldIsSet = isSet(); | 5 | boolean oldIsSet = isSet(); | ||||
6 | doAddAllUnique(index, objects, start, end); | 6 | doAddAllUnique(index, objects, start, end); | ||||
7 | NotificationImpl notification; | 7 | NotificationImpl notification; | ||||
8 | if (collectionSize == 1) | 8 | if (collectionSize == 1) | ||||
9 | notification = createNotification(Notification.ADD, null, objects[0], index, oldIsSet); | 9 | notification = createNotification(Notification.ADD, null, objects[0], index, oldIsSet); | ||||
else | else | ||||||
10 | if (start != 0 || end != objects.length) | 10 | if (start != 0 || end != objects.length) | ||||
11 | Object[] actualObjects = new Object[collectionSize]; | 11 | Object[] actualObjects = new Object[collectionSize]; | ||||
12 | for (int i = 0, j = start; j < end; ++i, ++j) | 12 | for (int i = 0, j = start; j < end; ++i, ++j) | ||||
13 | actualObjects[i] = objects[j]; | 13 | actualObjects[i] = objects[j]; | ||||
14 | notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(actualObjects), index, oldIsSet); | 14 | notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(actualObjects), index, oldIsSet); | ||||
else | else | ||||||
15 | notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(objects), index, oldIsSet); | 15 | notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(objects), index, oldIsSet); | ||||
16 | if (hasInverse()) | 16 | if (hasInverse()) | ||||
17 | NotificationChain notifications = createNotificationChain(collectionSize); | 17 | NotificationChain notifications = createNotificationChain(collectionSize); | ||||
18 | int lastIndex = index + collectionSize; | 18 | int lastIndex = index + collectionSize; | ||||
19 | for (int i = index; i < lastIndex; ++i) | 19 | for (int i = index; i < lastIndex; ++i) | ||||
|
| 20 | @SuppressWarnings("unchecked") E value = (E)data[i]; | ||||
20 | E value = delegateGet(i); |
| | ||||
21 | notifications = inverseAdd(value, notifications); | 21 | notifications = inverseAdd(value, notifications); | ||||
22 | notifications = shadowAdd(value, notifications); | 22 | notifications = shadowAdd(value, notifications); | ||||
23 | if (notifications == null) | 23 | if (notifications == null) | ||||
24 | dispatchNotification(notification); | 24 | dispatchNotification(notification); | ||||
else | else | ||||||
25 | notifications.add(notification); | 25 | notifications.add(notification); | ||||
26 | notifications.dispatch(); | 26 | notifications.dispatch(); | ||||
else | else | ||||||
27 | dispatchNotification(notification); | 27 | dispatchNotification(notification); |
Row | Violation |
---|---|
1 | Unmatched statement @SuppressWarnings("unchecked") E value=(E)data[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement E value=delegateGet(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |