boolean oldIsSet = isSet(); doAddAllUnique(index, collection); NotificationImpl notification = collectionSize == 1 ? createNotification(Notification.ADD, null, collection.iterator().next(), index, oldIsSet) : createNotification(Notification.ADD_MANY, null, collection, 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, collection); NotificationImpl notification = collectionSize == 1 ? createNotification(Notification.ADD, null, collection.iterator().next(), index, oldIsSet) : createNotification(Notification.ADD_MANY, null, collection, 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, Collection) Method name: boolean addAllUnique(int, Collection)
Number of AST nodes: 15 Number of AST nodes: 15
1
boolean oldIsSet = isSet();
1
boolean oldIsSet = isSet();
2
        doAddAllUnique(index, collection);
2
        doAddAllUnique(index, collection);
3
        NotificationImpl notification =
3
        NotificationImpl notification =
4
          collectionSize == 1 ?
4
          collectionSize == 1 ?
5
            createNotification(Notification.ADD, null, collection.iterator().next(), index, oldIsSet) :
5
            createNotification(Notification.ADD, null, collection.iterator().next(), index, oldIsSet) :
6
            createNotification(Notification.ADD_MANY, null, collection, index, oldIsSet);
6
            createNotification(Notification.ADD_MANY, null, collection, index, oldIsSet);
7
        if (hasInverse())
7
        if (hasInverse())
8
        {
8
        {
9
          NotificationChain notifications = createNotificationChain(collectionSize);
9
          NotificationChain notifications = createNotificationChain(collectionSize);
10
          int lastIndex = index + collectionSize;
10
          int lastIndex = index + collectionSize;
11
          for (int i = index; i < lastIndex; ++i)
11
          for (int i = index; i < lastIndex; ++i)
12
          {            
12
          {            
13
            E value = delegateGet(i);
13
            @SuppressWarnings("unchecked") E value = (E)data[i];
14
            notifications = inverseAdd(value, notifications);
14
            notifications = inverseAdd(value, notifications);
15
            notifications = shadowAdd(value, notifications);
15
            notifications = shadowAdd(value, notifications);
16
          }
16
          }
17
          if (notifications == null)
17
          if (notifications == null)
18
          {
18
          {
19
            dispatchNotification(notification);
19
            dispatchNotification(notification);
20
          }
20
          }
21
          else
21
          else
22
          {
22
          {
23
            notifications.add(notification);
23
            notifications.add(notification);
24
            notifications.dispatch();
24
            notifications.dispatch();
25
          }
25
          }
26
        }
26
        }
27
        else
27
        else
28
        {
28
        {
29
          dispatchNotification(notification);
29
          dispatchNotification(notification);
30
        }
30
        }
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.4
Clones locationClones are in different classes having the same super class
Number of node comparisons75
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)3561.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    5
    boolean oldIsSet = isSet();
    5
    boolean oldIsSet = isSet();
    6
    doAddAllUnique(index, collection);
    6
    doAddAllUnique(index, collection);
    6
    doAddAllUnique(index, collection);
    Differences
    Expression1Expression2Difference
    java.util.Collection<>java.util.Collection<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    • Make classes java.util.Collection<> and java.util.Collection<> extend a common superclass
    6
    doAddAllUnique(index, collection);
    7
    NotificationImpl notification = collectionSize == 1 ? createNotification(Notification.ADD, null, collection.iterator().next(), index, oldIsSet) : createNotification(Notification.ADD_MANY, null, collection, index, oldIsSet);
    7
    NotificationImpl notification = collectionSize == 1 ? createNotification(Notification.ADD, null, collection.iterator().next(), index, oldIsSet) : createNotification(Notification.ADD_MANY, null, collection, index, oldIsSet);
    7
    NotificationImpl notification = collectionSize == 1 ? createNotification(Notification.ADD, null, collection.iterator().next(), index, oldIsSet) : createNotification(Notification.ADD_MANY, null, collection, index, oldIsSet);
    Differences
    Expression1Expression2Difference
    java.util.Iterator<>java.util.Iterator<>VARIABLE_TYPE_MISMATCH
    java.util.Collection<>java.util.Collection<>VARIABLE_TYPE_MISMATCH
    java.util.Collection<>java.util.Collection<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Iterator<> of variable collection.iterator() does not match with type java.util.Iterator<> of variable collection.iterator()
    • Make classes java.util.Iterator<> and java.util.Iterator<> extend a common superclass
    Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    • Make classes java.util.Collection<> and java.util.Collection<> extend a common superclass
    Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    • Make classes java.util.Collection<> and java.util.Collection<> extend a common superclass
    7
    NotificationImpl notification = collectionSize == 1 ? createNotification(Notification.ADD, null, collection.iterator().next(), index, oldIsSet) : createNotification(Notification.ADD_MANY, null, collection, index, oldIsSet);
    8
    if (hasInverse())
    8
    if (hasInverse())
    9
    NotificationChain notifications = createNotificationChain(collectionSize);
    9
    NotificationChain notifications = createNotificationChain(collectionSize);
    10
    int lastIndex = index + collectionSize;
    10
    int lastIndex = index + collectionSize;
    11
    for (int i = index; i < lastIndex; ++i)
    11
    for (int i = index; i < lastIndex; ++i)
                                                                                                                
    12
    @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
    12
    @SuppressWarnings("unchecked") E value = (E)data[i];
    12
    E value = delegateGet(i);
    12
    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
                                                          
    13
    notifications = inverseAdd(value, notifications);
    13
    notifications = inverseAdd(value, notifications);
    14
    notifications = shadowAdd(value, notifications);
    14
    notifications = shadowAdd(value, notifications);
    15
    if (notifications == null)
    15
    if (notifications == null)
    16
    dispatchNotification(notification);
    16
    dispatchNotification(notification);
    else
    else
    17
    notifications.add(notification);
    17
    notifications.add(notification);
    18
    notifications.dispatch();
    18
    notifications.dispatch();
    else
    else
    19
    dispatchNotification(notification);
    19
    dispatchNotification(notification);
    Precondition Violations (6)
    Row Violation
    1Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    2Type java.util.Iterator<> of variable collection.iterator() does not match with type java.util.Iterator<> of variable collection.iterator()
    3Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    4Type java.util.Collection<> of variable collection does not match with type java.util.Collection<> of variable collection
    5Unmatched 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
    6Unmatched 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