boolean oldIsSet = isSet(); doAddAllUnique(index, objects, start, end); NotificationImpl notification; if (collectionSize == 1) { notification = createNotification(Notification.ADD, null, objects[0], index, oldIsSet); } else { if (start != 0 || end != objects.length) { Object [] actualObjects = new Object [collectionSize]; for (int i = 0, j = start; j < end; ++i, ++j) { actualObjects[i] = objects[j]; } notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(actualObjects), index, oldIsSet); } else { notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(objects), index, oldIsSet); } } if (hasInverse()) { NotificationChain notifications = createNotificationChain(collectionSize); int lastIndex = index + collectionSize; for (int i = index; i < lastIndex; ++i) { E value = delegateGet(i); notifications = inverseAdd(value, notifications); notifications = shadowAdd(value, notifications); } if (notifications == null) { dispatchNotification(notification); } else { notifications.add(notification); notifications.dispatch(); } } else { dispatchNotification(notification); }
boolean oldIsSet = isSet(); doAddAllUnique(index, objects, start, end); NotificationImpl notification; if (collectionSize == 1) { notification = createNotification(Notification.ADD, null, objects[0], index, oldIsSet); } else { if (start != 0 || end != objects.length) { Object [] actualObjects = new Object [collectionSize]; for (int i = 0, j = start; j < end; ++i, ++j) { actualObjects[i] = objects[j]; } notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(actualObjects), index, oldIsSet); } else { notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(objects), index, oldIsSet); } } if (hasInverse()) { NotificationChain notifications = createNotificationChain(collectionSize); int lastIndex = index + collectionSize; for (int i = index; i < lastIndex; ++i) { @SuppressWarnings("unchecked") E value = (E)data[i]; notifications = inverseAdd(value, notifications); notifications = shadowAdd(value, notifications); } if (notifications == null) { dispatchNotification(notification); } else { notifications.add(notification); notifications.dispatch(); } } else { dispatchNotification(notification); }
Clone fragments detected by clone detection tool
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
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)1.1
Clones locationClones are in different classes having the same super class
Number of node comparisons105
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements22
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)5.8
    Clone typeType 2
    Mapped Statements
    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];
    Preondition Violations
    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
    20
    @SuppressWarnings("unchecked") E value = (E)data[i];
    20
    E value = delegateGet(i);
    20
    E value = delegateGet(i);
    Preondition Violations
    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
                                                          
    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);
    Precondition Violations (2)
    Row Violation
    1Unmatched 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
    2Unmatched 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