protected boolean doAddAllUnique(int index, Object [] objects, int start, int end) { return super.addAllUnique(index, objects, start, end); } /** * Adds the object at the end of the list and returns the potentially updated notification chain; * it does no {@link #inverseAdd inverse} updating. * This implementation generates notifications as {@link #isNotificationRequired required}. * @param object the object to be added. * @return the notification chain. * @see #isNotificationRequired * @see #hasInverse * @see #inverseAdd */ public NotificationChain basicAdd(E object, NotificationChain notifications) { if (isNotificationRequired()) { int index = size(); boolean oldIsSet = isSet(); doAddUnique(index, object); NotificationImpl notification = createNotification(Notification.ADD, null, object, index, oldIsSet); if (notifications == null) { notifications = notification; } else { notifications.add(notification); } } else { doAddUnique(size(), object); } return notifications; } /** * Removes the object at the index from the list and returns it. * In addition to the normal effects, * this override implementation generates notifications as {@link #isNotificationRequired required} * and delegates to {@link #inverseRemove inverseRemove} as {@link #hasInverse required}. * @param index the position of the object to remove. * @return the removed object. * @exception IndexOutOfBoundsException if the index isn't within the size range. * @see #isNotificationRequired * @see #hasInverse * @see #inverseRemove */ @Override public E remove(int index) { if (isNotificationRequired()) { NotificationChain notifications = null; boolean oldIsSet = isSet(); if (hasShadow()) { notifications = shadowRemove(basicGet(index), null); } E oldObject; NotificationImpl notification = createNotification(Notification.REMOVE, oldObject = doRemove(index), null, index, oldIsSet); if (hasInverse() && oldObject != null) { notifications = inverseRemove(oldObject, notifications); if (notifications == null) { dispatchNotification(notification); } else { notifications.add(notification); notifications.dispatch(); } } else { if (notifications == null) { dispatchNotification(notification); } else { notifications.add(notification); notifications.dispatch(); } } return oldObject; } else { E oldObject = doRemove(index); if (hasInverse() && oldObject != null) { NotificationChain notifications = inverseRemove(oldObject, null); if (notifications != null) notifications.dispatch(); } return oldObject; } } /** * Removes the object at the index from the list and returns it; * it does no inverse updating, or notification. * @param index the position of the object to remove. * @return the removed object. * @exception IndexOutOfBoundsException if the index isn't within the size range. */ protected E doRemove(int index) { return super.remove(index);
protected boolean doAddAllUnique(int index, Object [] objects, int start, int end) { return super.addAllUnique(index, objects, start, end); } /** * Adds the object at the end of the list and returns the potentially updated notification chain; * it does no {@link #inverseAdd inverse} updating. * This implementation generates notifications as {@link #isNotificationRequired required}. * @param object the object to be added. * @return the notification chain. * @see #isNotificationRequired * @see #hasInverse * @see #inverseAdd */ public NotificationChain basicAdd(E object, NotificationChain notifications) { if (isNotificationRequired()) { int index = size; boolean oldIsSet = isSet(); doAddUnique(index, object); NotificationImpl notification = createNotification(Notification.ADD, null, object, index, oldIsSet); if (notifications == null) { notifications = notification; } else { notifications.add(notification); } } else { doAddUnique(size, object); } return notifications; } /** * Removes the object at the index from the list and returns it. * In addition to the normal effects, * this override implementation generates notifications as {@link #isNotificationRequired required} * and delegates to {@link #inverseRemove inverseRemove} as {@link #hasInverse required}. * @param index the position of the object to remove. * @return the removed object. * @exception IndexOutOfBoundsException if the index isn't within the size range. * @see #isNotificationRequired * @see #hasInverse * @see #inverseRemove */ @Override public E remove(int index) { if (isNotificationRequired()) { NotificationChain notifications = null; boolean oldIsSet = isSet(); if (hasShadow()) { notifications = shadowRemove(basicGet(index), null); } E oldObject; NotificationImpl notification = createNotification(Notification.REMOVE, oldObject = doRemove(index), null, index, oldIsSet); if (hasInverse() && oldObject != null) { notifications = inverseRemove(oldObject, notifications); if (notifications == null) { dispatchNotification(notification); } else { notifications.add(notification); notifications.dispatch(); } } else { if (notifications == null) { dispatchNotification(notification); } else { notifications.add(notification); notifications.dispatch(); } } return oldObject; } else { E oldObject = doRemove(index); if (hasInverse() && oldObject != null) { NotificationChain notifications = inverseRemove(oldObject, null); if (notifications != null) notifications.dispatch(); } return oldObject; } } /** * Removes the object at the index from the list and returns it; * it does no inverse updating, or notification. * @param index the position of the object to remove. * @return the removed object. * @exception IndexOutOfBoundsException if the index isn't within the size range. */ protected E doRemove(int index) { return super.remove(index);
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: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
protected boolean doAddAllUnique(int index, Object [] objects, int start, int end)
1
protected boolean doAddAllUnique(int index, Object [] objects, int start, int end)
2
  {
2
  {
3
    return super.addAllUnique(index, objects, start, end);
3
    return super.addAllUnique(index, objects, start, end);
4
  }
4
  }
5
  
5
  /**
6
  /**
6
   * Adds the object at the end of the list and returns the potentially updated notification chain;
7
   * Adds the object at the end of the list and returns the potentially updated notification chain;
7
   * it does no {@link #inverseAdd inverse} updating.
8
   * it does no {@link #inverseAdd inverse} updating.
8
   * This implementation generates notifications as {@link #isNotificationRequired required}.
9
   * This implementation generates notifications as {@link #isNotificationRequired required}.
9
   * @param object the object to be added.
10
   * @param object the object to be added.
10
   * @return the notification chain.
11
   * @return the notification chain.
11
   * @see #isNotificationRequired
12
   * @see #isNotificationRequired
12
   * @see #hasInverse
13
   * @see #hasInverse
13
   * @see #inverseAdd
14
   * @see #inverseAdd
14
   */
15
   */
15
  public NotificationChain basicAdd(E object, NotificationChain notifications)
16
  public NotificationChain basicAdd(E object, NotificationChain notifications)
16
  {
17
  {
17
    if (isNotificationRequired())
18
    if (isNotificationRequired())
18
    {
19
    {
19
      int index = size();
20
      int index = size;
20
      boolean oldIsSet = isSet();
21
      boolean oldIsSet = isSet();
21
      doAddUnique(index, object);
22
      doAddUnique(index, object);
22
      NotificationImpl notification = createNotification(Notification.ADD, null, object, index, oldIsSet);
23
      NotificationImpl notification = createNotification(Notification.ADD, null, object, index, oldIsSet);
23
      if (notifications == null)
24
      if (notifications == null)
24
      {
25
      {
25
        notifications = notification;
26
        notifications = notification;
26
      }
27
      }
27
      else
28
      else
28
      {
29
      {
29
        notifications.add(notification);
30
        notifications.add(notification);
30
      }
31
      }
31
    }
32
    }
32
    else
33
    else
33
    {
34
    {
34
      doAddUnique(size(), object);
35
      doAddUnique(size, object);
35
    }
36
    }
36
    return notifications;
37
    return notifications;
37
  }
38
  }
38
  /**
39
  /**
39
   * Removes the object at the index from the list and returns it.
40
   * Removes the object at the index from the list and returns it.
40
   * In addition to the normal effects, 
41
   * In addition to the normal effects, 
41
   * this override implementation generates notifications as {@link #isNotificationRequired required} 
42
   * this override implementation generates notifications as {@link #isNotificationRequired required} 
42
   * and delegates to {@link #inverseRemove inverseRemove} as {@link #hasInverse required}.
43
   * and delegates to {@link #inverseRemove inverseRemove} as {@link #hasInverse required}.
43
   * @param index the position of the object to remove.
44
   * @param index the position of the object to remove.
44
   * @return the removed object.
45
   * @return the removed object.
45
   * @exception IndexOutOfBoundsException if the index isn't within the size range.
46
   * @exception IndexOutOfBoundsException if the index isn't within the size range.
46
   * @see #isNotificationRequired
47
   * @see #isNotificationRequired
47
   * @see #hasInverse
48
   * @see #hasInverse
48
   * @see #inverseRemove
49
   * @see #inverseRemove
49
   */
50
   */
50
  @Override
51
  @Override
51
  public E remove(int index)
52
  public E remove(int index)
52
  {
53
  {
53
    if (isNotificationRequired())
54
    if (isNotificationRequired())
54
    {
55
    {
55
      NotificationChain notifications = null;
56
      NotificationChain notifications = null;
56
      boolean oldIsSet = isSet();
57
      boolean oldIsSet = isSet();
57
      if (hasShadow())
58
      if (hasShadow())
58
      {
59
      {
59
        notifications = shadowRemove(basicGet(index), null);
60
        notifications = shadowRemove(basicGet(index), null);
60
      }
61
      }
61
      E oldObject;
62
      E oldObject;
62
      NotificationImpl notification = createNotification(Notification.REMOVE, oldObject = doRemove(index), null, index, oldIsSet);
63
      NotificationImpl notification = createNotification(Notification.REMOVE, oldObject = doRemove(index), null, index, oldIsSet);
63
      if (hasInverse() && oldObject != null)
64
      if (hasInverse() && oldObject != null)
64
      {
65
      {
65
        notifications = inverseRemove(oldObject, notifications);
66
        notifications = inverseRemove(oldObject, notifications);
66
        if (notifications == null)
67
        if (notifications == null)
67
        {
68
        {
68
          dispatchNotification(notification);
69
          dispatchNotification(notification);
69
        }
70
        }
70
        else
71
        else
71
        {
72
        {
72
          notifications.add(notification);
73
          notifications.add(notification);
73
          notifications.dispatch();
74
          notifications.dispatch();
74
        }
75
        }
75
      }
76
      }
76
      else
77
      else
77
      {
78
      {
78
        if (notifications == null)
79
        if (notifications == null)
79
        {
80
        {
80
          dispatchNotification(notification);
81
          dispatchNotification(notification);
81
        }
82
        }
82
        else
83
        else
83
        {
84
        {
84
          notifications.add(notification);
85
          notifications.add(notification);
85
          notifications.dispatch();
86
          notifications.dispatch();
86
        }
87
        }
87
      }
88
      }
88
      return oldObject;
89
      return oldObject;
89
    }
90
    }
90
    else
91
    else
91
    {
92
    {
92
      E oldObject = doRemove(index);
93
      E oldObject = doRemove(index);
93
      if (hasInverse() && oldObject != null)
94
      if (hasInverse() && oldObject != null)
94
      {
95
      {
95
        NotificationChain notifications = inverseRemove(oldObject, null);
96
        NotificationChain notifications = inverseRemove(oldObject, null);
96
        if (notifications != null) notifications.dispatch();
97
        if (notifications != null) notifications.dispatch();
97
      }
98
      }
98
      return oldObject;
99
      return oldObject;
99
    }
100
    }
100
  }
101
  }
101
  /**
102
  /**
102
   * Removes the object at the index from the list and returns it;
103
   * Removes the object at the index from the list and returns it;
103
   * it does no inverse updating, or notification.
104
   * it does no inverse updating, or notification.
104
   * @param index the position of the object to remove.
105
   * @param index the position of the object to remove.
105
   * @return the removed object.
106
   * @return the removed object.
106
   * @exception IndexOutOfBoundsException if the index isn't within the size range.
107
   * @exception IndexOutOfBoundsException if the index isn't within the size range.
107
   */
108
   */
108
  protected E doRemove(int index)
109
  protected E doRemove(int index)
109
  {
110
  {
110
    return super.remove(index);
111
    return super.remove(index);
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0