if (isNotificationRequired()) { NotificationChain notifications = null; boolean oldIsSet = isSet(); E oldObject; Notification notification = createNotification(Notification.SET, oldObject = doSetUnique(index, object), object, index, oldIsSet); if (hasInverse() && !equalObjects(oldObject, object)) { if (oldObject != null) { notifications = inverseRemove(oldObject, notifications); } notifications = inverseAdd(object, notifications); if (hasShadow()) { notifications = shadowSet(oldObject, object, notifications); } if (notifications == null) { dispatchNotification(notification); } else { notifications.add(notification); notifications.dispatch(); } } else { if (hasShadow()) { notifications = shadowSet(oldObject, object, notifications); } if (notifications == null) { dispatchNotification(notification); } else { notifications.add(notification); notifications.dispatch(); } } return oldObject; } else { E oldObject = doSetUnique(index, object); if (hasInverse() && !equalObjects(oldObject, object)) { NotificationChain notifications = null; if (oldObject != null) { notifications = inverseRemove(oldObject, null); } notifications = inverseAdd(object, notifications); if (notifications != null) notifications.dispatch(); } return oldObject; }
if (isNotificationRequired()) { NotificationChain notifications = null; boolean oldIsSet = isSet(); E oldObject; Notification notification = createNotification(Notification.SET, oldObject = doSetUnique(index, object), object, index, oldIsSet); if (hasInverse() && !equalObjects(oldObject, object)) { if (oldObject != null) { notifications = inverseRemove(oldObject, notifications); } notifications = inverseAdd(object, notifications); if (hasShadow()) { notifications = shadowSet(oldObject, object, notifications); } if (notifications == null) { dispatchNotification(notification); } else { notifications.add(notification); notifications.dispatch(); } } else { if (hasShadow()) { notifications = shadowSet(oldObject, object, notifications); } if (notifications == null) { dispatchNotification(notification); } else { notifications.add(notification); notifications.dispatch(); } } return oldObject; } else { E oldObject = doSetUnique(index, object); if (hasInverse() && !equalObjects(oldObject, object)) { NotificationChain notifications = null; if (oldObject != null) { notifications = inverseRemove(oldObject, null); } notifications = inverseAdd(object, notifications); if (notifications != null) notifications.dispatch(); } return oldObject; }
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: E setUnique(int, E) Method name: E setUnique(int, E)
Number of AST nodes: 31 Number of AST nodes: 31
1
if (isNotificationRequired())
1
if (isNotificationRequired())
2
    {
2
    {
3
      NotificationChain notifications = null;
3
      NotificationChain notifications = null;
4
      boolean oldIsSet = isSet();
4
      boolean oldIsSet = isSet();
5
      E oldObject;
5
      E oldObject;
6
      Notification notification = createNotification(Notification.SET, oldObject = doSetUnique(index, object), object, index, oldIsSet);
6
      Notification notification = createNotification(Notification.SET, oldObject = doSetUnique(index, object), object, index, oldIsSet);
7
      if (hasInverse() && !equalObjects(oldObject, object))
7
      if (hasInverse() && !equalObjects(oldObject, object))
8
      {
8
      {
9
        if (oldObject != null)
9
        if (oldObject != null)
10
        {
10
        {
11
          notifications = inverseRemove(oldObject, notifications);
11
          notifications = inverseRemove(oldObject, notifications);
12
        }
12
        }
13
        notifications = inverseAdd(object, notifications);
13
        notifications = inverseAdd(object, notifications);
14
        if (hasShadow())
14
        if (hasShadow())
15
        {
15
        {
16
          notifications = shadowSet(oldObject, object, notifications);
16
          notifications = shadowSet(oldObject, object, notifications);
17
        }
17
        }
18
        if (notifications == null)
18
        if (notifications == null)
19
        {
19
        {
20
          dispatchNotification(notification);
20
          dispatchNotification(notification);
21
        }
21
        }
22
        else
22
        else
23
        {
23
        {
24
          notifications.add(notification);
24
          notifications.add(notification);
25
          notifications.dispatch();
25
          notifications.dispatch();
26
        }
26
        }
27
      }
27
      }
28
      else
28
      else
29
      {
29
      {
30
        if (hasShadow())
30
        if (hasShadow())
31
        {
31
        {
32
          notifications = shadowSet(oldObject, object, notifications);
32
          notifications = shadowSet(oldObject, object, 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
      return oldObject;
44
      return oldObject;
45
    }
45
    }
46
    else
46
    else
47
    {
47
    {
48
      E oldObject = doSetUnique(index, object);
48
      E oldObject = doSetUnique(index, object);
49
      if (hasInverse() && !equalObjects(oldObject, object))
49
      if (hasInverse() && !equalObjects(oldObject, object))
50
      {
50
      {
51
        NotificationChain notifications = null;
51
        NotificationChain notifications = null;
52
        if (oldObject != null)
52
        if (oldObject != null)
53
        {
53
        {
54
          notifications = inverseRemove(oldObject, null);
54
          notifications = inverseRemove(oldObject, null);
55
        }
55
        }
56
        notifications = inverseAdd(object, notifications);
56
        notifications = inverseAdd(object, notifications);
57
        if (notifications != null) notifications.dispatch();
57
        if (notifications != null) notifications.dispatch();
58
      }
58
      }
59
      return oldObject;
59
      return oldObject;
60
    }
60
    }
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)3.0
Clones locationClones are in different classes having the same super class
Number of node comparisons221
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements31
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)12.9
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    1
    if (isNotificationRequired())
    1
    if (isNotificationRequired())
    2
    NotificationChain notifications = null;
    2
    NotificationChain notifications = null;
    3
    boolean oldIsSet = isSet();
    3
    boolean oldIsSet = isSet();
    4
    E oldObject;
    4
    E oldObject;
    5
    Notification notification = createNotification(Notification.SET, oldObject = doSetUnique(index, object), object, index, oldIsSet);
    5
    Notification notification = createNotification(Notification.SET, oldObject = doSetUnique(index, object), object, index, oldIsSet);
    6
    if (hasInverse() && !equalObjects(oldObject, object))
    6
    if (hasInverse() && !equalObjects(oldObject, object))
    7
    if (oldObject != null)
    7
    if (oldObject != null)
    8
    notifications = inverseRemove(oldObject, notifications);
    8
    notifications = inverseRemove(oldObject, notifications);
    9
    notifications = inverseAdd(object, notifications);
    9
    notifications = inverseAdd(object, notifications);
    10
    if (hasShadow())
    10
    if (hasShadow())
    11
    notifications = shadowSet(oldObject, object, notifications);
    11
    notifications = shadowSet(oldObject, object, notifications);
    12
    if (notifications == null)
    12
    if (notifications == null)
    13
    dispatchNotification(notification);
    13
    dispatchNotification(notification);
    else
    else
    14
    notifications.add(notification);
    14
    notifications.add(notification);
    15
    notifications.dispatch();
    15
    notifications.dispatch();
    else
    else
    16
    if (hasShadow())
    16
    if (hasShadow())
    17
    notifications = shadowSet(oldObject, object, notifications);
    17
    notifications = shadowSet(oldObject, object, notifications);
    18
    if (notifications == null)
    18
    if (notifications == null)
    19
    dispatchNotification(notification);
    19
    dispatchNotification(notification);
    else
    else
    20
    notifications.add(notification);
    20
    notifications.add(notification);
    21
    notifications.dispatch();
    21
    notifications.dispatch();
    22
    return oldObject;
    22
    return oldObject;
    else
    else
    23
    E oldObject = doSetUnique(index, object);
    23
    E oldObject = doSetUnique(index, object);
    24
    if (hasInverse() && !equalObjects(oldObject, object))
    24
    if (hasInverse() && !equalObjects(oldObject, object))
    25
    NotificationChain notifications = null;
    25
    NotificationChain notifications = null;
    26
    if (oldObject != null)
    26
    if (oldObject != null)
    27
    notifications = inverseRemove(oldObject, null);
    27
    notifications = inverseRemove(oldObject, null);
    28
    notifications = inverseAdd(object, notifications);
    28
    notifications = inverseAdd(object, notifications);
    29
    if (notifications != null)
    29
    if (notifications != null)
    30
    notifications.dispatch();
    30
    notifications.dispatch();
    31
    return oldObject;
    31
    return oldObject;
    Precondition Violations (0)
    Row Violation