if (isNotificationRequired()) { int index = size(); 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(object); if (hasInverse()) { NotificationChain notifications = inverseAdd(object, null); if (notifications != null) notifications.dispatch(); } }
if (isNotificationRequired()) { int index = size; boolean oldIsSet = isSet(); doAddUnique(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(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(E) Method name: void addUnique(E)
Number of AST nodes: 19 Number of AST nodes: 19
1
if (isNotificationRequired())
1
if (isNotificationRequired())
2
    {
2
    {
3
      int index = size();
3
      int index = size;
4
      boolean oldIsSet = isSet();
4
      boolean oldIsSet = isSet();
5
      doAddUnique(index, object);
5
      doAddUnique(object);
6
      NotificationImpl notification = createNotification(Notification.ADD, null, object, index, oldIsSet);
6
      NotificationImpl notification = createNotification(Notification.ADD, null, object, index, oldIsSet);
7
      if (hasInverse())
7
      if (hasInverse())
8
      {
8
      {
9
        NotificationChain notifications = inverseAdd(object, null);
9
        NotificationChain notifications = inverseAdd(object, null);
10
        if (hasShadow())
10
        if (hasShadow())
11
        {
11
        {
12
          notifications = shadowAdd(object, notifications);
12
          notifications = shadowAdd(object, notifications);
13
        }
13
        }
14
        if (notifications == null)
14
        if (notifications == null)
15
        {
15
        {
16
          dispatchNotification(notification);
16
          dispatchNotification(notification);
17
        }
17
        }
18
        else
18
        else
19
        {
19
        {
20
          notifications.add(notification);
20
          notifications.add(notification);
21
          notifications.dispatch();
21
          notifications.dispatch();
22
        }
22
        }
23
      }
23
      }
24
      else
24
      else
25
      {
25
      {
26
        dispatchNotification(notification);
26
        dispatchNotification(notification);
27
      }
27
      }
28
    }
28
    }
29
    else
29
    else
30
    {
30
    {
31
      doAddUnique(object);
31
      doAddUnique(object);
32
      if (hasInverse())
32
      if (hasInverse())
33
      {
33
      {
34
        NotificationChain notifications = inverseAdd(object, null);
34
        NotificationChain notifications = inverseAdd(object, null);
35
        if (notifications != null) notifications.dispatch();
35
        if (notifications != null) notifications.dispatch();
36
      }
36
      }
37
    }
37
    }
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)0.7
Clones locationClones are in different classes having the same super class
Number of node comparisons89
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements19
    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 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (isNotificationRequired())
    1
    if (isNotificationRequired())
    2
    int index = size();
    2
    int index = size();
    2
    int index = size;
    Differences
    Expression1Expression2Difference
    size()sizeTYPE_COMPATIBLE_REPLACEMENT
    2
    int index = size;
    3
    boolean oldIsSet = isSet();
    3
    boolean oldIsSet = isSet();
    4
    doAddUnique(index, object);
    4
    doAddUnique(index, object);
    4
    doAddUnique(object);
    Differences
    Expression1Expression2Difference
    doAddUnique(index,object)doAddUnique(object)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression doAddUnique(index,object) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression doAddUnique(index,object) is a void method call, and thus it cannot be parameterized
    Expression doAddUnique(object) is a void method call, and thus it cannot be parameterized
    4
    doAddUnique(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
    NotificationChain notifications = inverseAdd(object, null);
    7
    NotificationChain notifications = inverseAdd(object, null);
    8
    if (hasShadow())
    8
    if (hasShadow())
    9
    notifications = shadowAdd(object, notifications);
    9
    notifications = shadowAdd(object, notifications);
    10
    if (notifications == null)
    10
    if (notifications == null)
    11
    dispatchNotification(notification);
    11
    dispatchNotification(notification);
    else
    else
    12
    notifications.add(notification);
    12
    notifications.add(notification);
    13
    notifications.dispatch();
    13
    notifications.dispatch();
    else
    else
    14
    dispatchNotification(notification);
    14
    dispatchNotification(notification);
    else
    else
    15
    doAddUnique(object);
    15
    doAddUnique(object);
    16
    if (hasInverse())
    16
    if (hasInverse())
    17
    NotificationChain notifications = inverseAdd(object, null);
    17
    NotificationChain notifications = inverseAdd(object, null);
    18
    if (notifications != null)
    18
    if (notifications != null)
    19
    notifications.dispatch();
    19
    notifications.dispatch();
    Precondition Violations (3)
    Row Violation
    1Expression doAddUnique(index,object) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression doAddUnique(index,object) is a void method call, and thus it cannot be parameterized
    3Expression doAddUnique(object) is a void method call, and thus it cannot be parameterized