145-1-2

if (isNotificationRequired()) { boolean oldIsSet = isSet(); NotificationImpl notification = createNotification(Notification.SET, doSetUnique(index, object), object, index, oldIsSet); if (notifications == null) { notifications = notification; } else { notifications.add(notification); } } else { doSetUnique(index, object); } return notifications;
if (isNotificationRequired()) { boolean oldIsSet = isSet(); NotificationImpl notification = createNotification(Notification.SET, doSetUnique(index, object), object, index, oldIsSet); if (notifications == null) { notifications = notification; } else { notifications.add(notification); } } else { doSetUnique(index, object); } return notifications;

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: `NotificationChain basicSet(int, E, NotificationChain)` |  | Method name: `NotificationChain basicSet(int, E, NotificationChain)`
Number of AST nodes: 8 |  | Number of AST nodes: 8

1

    if (isNotificationRequired())↵

1

    if (isNotificationRequired())↵

2

        {↵

2

        {↵

3

          boolean oldIsSet = isSet();↵

3

          boolean oldIsSet = isSet();↵

4

          NotificationImpl notification = ↵

4

          NotificationImpl notification = ↵

5

            createNotification(Notification.SET, doSetUnique(index, object), object, index, oldIsSet);↵

5

    createNotification(Notification.SET, doSetUnique(index, object), object, index, oldIsSet);↵

6

          if (notifications == null) ↵

6

          if (notifications == null) ↵

7

          {↵

7

          {↵

8

            notifications = notification;↵

8

            notifications = notification;↵

9

          }↵

9

          }↵

10

          else↵

10

          else↵

11

          {↵

11

          {↵

12

            notifications.add(notification);↵

12

            notifications.add(notification);↵

13

          }↵

13

          }↵

14

        }↵

14

        }↵

15

        else↵

15

        else↵

16

        {↵

16

        {↵

17

          doSetUnique(index, object);↵

17

          doSetUnique(index, object);↵

18

        }↵

18

        }↵

19

        return notifications;

19

        return notifications;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 26

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 8
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 4.8
   Clone type | Type 1

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       if (isNotificationRequired())

   1

       if (isNotificationRequired())

   2

       boolean oldIsSet = isSet();

   2

       boolean oldIsSet = isSet();

   3

       NotificationImpl notification = createNotification(Notification.SET, doSetUnique(index, object), object, index, oldIsSet);

   3

       NotificationImpl notification = createNotification(Notification.SET, doSetUnique(index, object), object, index, oldIsSet);

   4

       if (notifications == null)

   4

       if (notifications == null)

   5

       notifications = notification;

   5

       notifications = notification;

       else

       else

   6

       notifications.add(notification);

   6

       notifications.add(notification);

       else

       else

   7

       doSetUnique(index, object);

   7

       doSetUnique(index, object);

   8

       return notifications;

   8

       return notifications;

   Precondition Violations (1)
   Row | Violation
   --- | ---
   1 | The refactoring of the clones is infeasible, because classes org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl and org.eclipse.emf.common.notify.impl.NotifyingListImpl do not have a common superclass