if (isNotificationRequired()) { boolean oldIsSet = isSet(); doAddUnique(index, object); NotificationImpl notification = createNotification(Notification.ADD, null, object, index, oldIsSet); if (hasInverse()) { NotificationChain notifications = inverseAdd(object, null); if (hasShadow()) { notifications = shadowAdd(object, notifications); } if (notifications == null) { dispatchNotification(notification); } else { notifications.add(notification); notifications.dispatch(); } } else { dispatchNotification(notification); } } else { doAddUnique(index, object); if (hasInverse()) { NotificationChain notifications = inverseAdd(object, null); if (notifications != null) notifications.dispatch(); } }
if (isNotificationRequired()) { boolean oldIsSet = isSet(); doAddUnique(index, object); NotificationImpl notification = createNotification(Notification.ADD, null, object, index, oldIsSet); if (hasInverse()) { NotificationChain notifications = inverseAdd(object, null); if (hasShadow()) { notifications = shadowAdd(object, notifications); } if (notifications == null) { dispatchNotification(notification); } else { notifications.add(notification); notifications.dispatch(); } } else { dispatchNotification(notification); } } else { doAddUnique(index, object); if (hasInverse()) { NotificationChain notifications = inverseAdd(object, null); if (notifications != null) notifications.dispatch(); } }
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: void addUnique(int, E) Method name: void addUnique(int, E)
Number of AST nodes: 18 Number of AST nodes: 18
1
if (isNotificationRequired())
1
if (isNotificationRequired())
2
    {
2
    {
3
      boolean oldIsSet = isSet();
3
      boolean oldIsSet = isSet();
4
      doAddUnique(index, object);
4
      doAddUnique(index, object);
5
      NotificationImpl notification = createNotification(Notification.ADD, null, object, index, oldIsSet);
5
      NotificationImpl notification = createNotification(Notification.ADD, null, object, index, oldIsSet);
6
      if (hasInverse())
6
      if (hasInverse())
7
      {
7
      {
8
        NotificationChain notifications = inverseAdd(object, null);
8
        NotificationChain notifications = inverseAdd(object, null);
9
        if (hasShadow())
9
        if (hasShadow())
10
        {
10
        {
11
          notifications = shadowAdd(object, notifications);
11
          notifications = shadowAdd(object, notifications);
12
        }
12
        }
13
        if (notifications == null)
13
        if (notifications == null)
14
        {
14
        {
15
          dispatchNotification(notification);
15
          dispatchNotification(notification);
16
        }
16
        }
17
        else
17
        else
18
        {
18
        {
19
          notifications.add(notification);
19
          notifications.add(notification);
20
          notifications.dispatch();
20
          notifications.dispatch();
21
        }
21
        }
22
      }
22
      }
23
      else
23
      else
24
      {
24
      {
25
        dispatchNotification(notification);
25
        dispatchNotification(notification);
26
      }
26
      }
27
    }
27
    }
28
    else
28
    else
29
    {
29
    {
30
      doAddUnique(index, object);
30
      doAddUnique(index, object);
31
      if (hasInverse())
31
      if (hasInverse())
32
      {
32
      {
33
        NotificationChain notifications = inverseAdd(object, null);
33
        NotificationChain notifications = inverseAdd(object, null);
34
        if (notifications != null) notifications.dispatch();
34
        if (notifications != null) notifications.dispatch();
35
      }
35
      }
36
    }
36
    }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.7
Clones locationClones are in different classes having the same super class
Number of node comparisons78
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements18
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.5
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    1
    if (isNotificationRequired())
    1
    if (isNotificationRequired())
    2
    boolean oldIsSet = isSet();
    2
    boolean oldIsSet = isSet();
    3
    doAddUnique(index, object);
    3
    doAddUnique(index, object);
    4
    NotificationImpl notification = createNotification(Notification.ADD, null, object, index, oldIsSet);
    4
    NotificationImpl notification = createNotification(Notification.ADD, null, object, index, oldIsSet);
    5
    if (hasInverse())
    5
    if (hasInverse())
    6
    NotificationChain notifications = inverseAdd(object, null);
    6
    NotificationChain notifications = inverseAdd(object, null);
    7
    if (hasShadow())
    7
    if (hasShadow())
    8
    notifications = shadowAdd(object, notifications);
    8
    notifications = shadowAdd(object, notifications);
    9
    if (notifications == null)
    9
    if (notifications == null)
    10
    dispatchNotification(notification);
    10
    dispatchNotification(notification);
    else
    else
    11
    notifications.add(notification);
    11
    notifications.add(notification);
    12
    notifications.dispatch();
    12
    notifications.dispatch();
    else
    else
    13
    dispatchNotification(notification);
    13
    dispatchNotification(notification);
    else
    else
    14
    doAddUnique(index, object);
    14
    doAddUnique(index, object);
    15
    if (hasInverse())
    15
    if (hasInverse())
    16
    NotificationChain notifications = inverseAdd(object, null);
    16
    NotificationChain notifications = inverseAdd(object, null);
    17
    if (notifications != null)
    17
    if (notifications != null)
    18
    notifications.dispatch();
    18
    notifications.dispatch();
    Precondition Violations (0)
    Row Violation