protected void doClear() { super.clear(); } /** * Sets the object at the index * and returns the old object at the index; * it does no ranging checking or uniqueness checking. * In addition to the normal effects, * this override implementation generates notifications as {@link #isNotificationRequired required} * and delegates to {@link #inverseAdd inverseAdd} and {@link #inverseRemove inverseRemove} as {@link #hasInverse required}. * @param index the position in question. * @param object the object to set. * @return the old object at the index. * @see #isNotificationRequired * @see #hasInverse * @see #inverseAdd * @see #inverseRemove */ @Override public E setUnique(int index, E object) { 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; } } /** * Sets the object at the index * and returns the old object at the index; * it does no ranging checking, uniqueness checking, inverse updating or notification. * @param index the position in question. * @param object the object to set. * @return the old object at the index. */ protected E doSetUnique(int index, E object) { return super.setUnique(index, object); } /** * Sets the object at the index * and returns the potentially updated notification chain; * it does no {@link #hasInverse inverse} updating. * This implementation generates notifications as {@link #isNotificationRequired required}. * @param index the position in question. * @param object the object to set. * @return the notification chain. * @see #isNotificationRequired * @see #hasInverse * @see #inverseAdd * @see #inverseRemove */ public NotificationChain basicSet(int index, E object, NotificationChain 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; } /** * Moves the object at the source index of the list to the target index of the list * and returns the moved object. * In addition to the normal effects, * this override implementation generates notifications as {@link #isNotificationRequired required}. * @param targetIndex the new position for the object in the list. * @param sourceIndex the old position of the object in the list. * @return the moved object. * @exception IndexOutOfBoundsException if either index isn't within the size range. * @see #isNotificationRequired */ @Override public E move(int targetIndex, int sourceIndex) { if (isNotificationRequired()) { boolean oldIsSet = isSet(); E object = doMove(targetIndex, sourceIndex); dispatchNotification (createNotification (Notification.MOVE, sourceIndex, object, targetIndex, oldIsSet)); return object; } else { return doMove(targetIndex, sourceIndex); } } /** * Moves the object at the source index of the list to the target index of the list * and returns the moved object; * it does no notification. * @param targetIndex the new position for the object in the list. * @param sourceIndex the old position of the object in the list. * @return the moved object. * @exception IndexOutOfBoundsException if either index isn't within the size range. */ protected E doMove(int targetIndex, int sourceIndex) { return super.move(targetIndex, sourceIndex);
protected void doClear() { super.clear(); } /** * Sets the object at the index * and returns the old object at the index; * it does no ranging checking or uniqueness checking. * In addition to the normal effects, * this override implementation generates notifications as {@link #isNotificationRequired required} * and delegates to {@link #inverseAdd inverseAdd} and {@link #inverseRemove inverseRemove} as {@link #hasInverse required}. * @param index the position in question. * @param object the object to set. * @return the old object at the index. * @see #isNotificationRequired * @see #hasInverse * @see #inverseAdd * @see #inverseRemove */ @Override public E setUnique(int index, E object) { 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; } } /** * Sets the object at the index * and returns the old object at the index; * it does no ranging checking, uniqueness checking, inverse updating or notification. * @param index the position in question. * @param object the object to set. * @return the old object at the index. */ protected E doSetUnique(int index, E object) { return super.setUnique(index, object); } /** * Sets the object at the index * and returns the potentially updated notification chain; * it does no {@link #hasInverse inverse} updating. * This implementation generates notifications as {@link #isNotificationRequired required}. * @param index the position in question. * @param object the object to set. * @return the notification chain. * @see #isNotificationRequired * @see #hasInverse * @see #inverseAdd * @see #inverseRemove */ public NotificationChain basicSet(int index, E object, NotificationChain 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; } /** * Moves the object at the source index of the list to the target index of the list * and returns the moved object. * In addition to the normal effects, * this override implementation generates notifications as {@link #isNotificationRequired required}. * @param targetIndex the new position for the object in the list. * @param sourceIndex the old position of the object in the list. * @return the moved object. * @exception IndexOutOfBoundsException if either index isn't within the size range. * @see #isNotificationRequired */ @Override public E move(int targetIndex, int sourceIndex) { if (isNotificationRequired()) { boolean oldIsSet = isSet(); E object = doMove(targetIndex, sourceIndex); dispatchNotification (createNotification (Notification.MOVE, sourceIndex, object, targetIndex, oldIsSet)); return object; } else { return doMove(targetIndex, sourceIndex); } } /** * Moves the object at the source index of the list to the target index of the list * and returns the moved object; * it does no notification. * @param targetIndex the new position for the object in the list. * @param sourceIndex the old position of the object in the list. * @return the moved object. * @exception IndexOutOfBoundsException if either index isn't within the size range. */ protected E doMove(int targetIndex, int sourceIndex) { return super.move(targetIndex, sourceIndex);
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 void doClear()
1
protected void doClear()
2
  {
2
  {
3
    super.clear();
3
    super.clear();
4
  }
4
  }
5
  /**
5
  /**
6
   * Sets the object at the index
6
   * Sets the object at the index
7
   * and returns the old object at the index;
7
   * and returns the old object at the index;
8
   * it does no ranging checking or uniqueness checking.
8
   * it does no ranging checking or uniqueness checking.
9
   * In addition to the normal effects, 
9
   * In addition to the normal effects, 
10
   * this override implementation generates notifications as {@link #isNotificationRequired required} 
10
   * this override implementation generates notifications as {@link #isNotificationRequired required} 
11
   * and delegates to {@link #inverseAdd inverseAdd} and {@link #inverseRemove inverseRemove} as {@link #hasInverse required}.
11
   * and delegates to {@link #inverseAdd inverseAdd} and {@link #inverseRemove inverseRemove} as {@link #hasInverse required}.
12
   * @param index the position in question.
12
   * @param index the position in question.
13
   * @param object the object to set.
13
   * @param object the object to set.
14
   * @return the old object at the index.
14
   * @return the old object at the index.
15
   * @see #isNotificationRequired
15
   * @see #isNotificationRequired
16
   * @see #hasInverse
16
   * @see #hasInverse
17
   * @see #inverseAdd
17
   * @see #inverseAdd
18
   * @see #inverseRemove
18
   * @see #inverseRemove
19
   */
19
   */
20
  @Override
20
  @Override
21
  public E setUnique(int index, E object)
21
  public E setUnique(int index, E object)
22
  {
22
  {
23
    if (isNotificationRequired())
23
    if (isNotificationRequired())
24
    {
24
    {
25
      NotificationChain notifications = null;
25
      NotificationChain notifications = null;
26
      boolean oldIsSet = isSet();
26
      boolean oldIsSet = isSet();
27
      E oldObject;
27
      E oldObject;
28
      Notification notification = createNotification(Notification.SET, oldObject = doSetUnique(index, object), object, index, oldIsSet);
28
      Notification notification = createNotification(Notification.SET, oldObject = doSetUnique(index, object), object, index, oldIsSet);
29
      if (hasInverse() && !equalObjects(oldObject, object))
29
      if (hasInverse() && !equalObjects(oldObject, object))
30
      {
30
      {
31
        if (oldObject != null)
31
        if (oldObject != null)
32
        {
32
        {
33
          notifications = inverseRemove(oldObject, notifications);
33
          notifications = inverseRemove(oldObject, notifications);
34
        }
34
        }
35
        notifications = inverseAdd(object, notifications);
35
        notifications = inverseAdd(object, notifications);
36
        if (hasShadow())
36
        if (hasShadow())
37
        {
37
        {
38
          notifications = shadowSet(oldObject, object, notifications);
38
          notifications = shadowSet(oldObject, object, notifications);
39
        }
39
        }
40
        if (notifications == null)
40
        if (notifications == null)
41
        {
41
        {
42
          dispatchNotification(notification);
42
          dispatchNotification(notification);
43
        }
43
        }
44
        else
44
        else
45
        {
45
        {
46
          notifications.add(notification);
46
          notifications.add(notification);
47
          notifications.dispatch();
47
          notifications.dispatch();
48
        }
48
        }
49
      }
49
      }
50
      else
50
      else
51
      {
51
      {
52
        if (hasShadow())
52
        if (hasShadow())
53
        {
53
        {
54
          notifications = shadowSet(oldObject, object, notifications);
54
          notifications = shadowSet(oldObject, object, notifications);
55
        }
55
        }
56
        if (notifications == null)
56
        if (notifications == null)
57
        {
57
        {
58
          dispatchNotification(notification);
58
          dispatchNotification(notification);
59
        }
59
        }
60
        else
60
        else
61
        {
61
        {
62
          notifications.add(notification);
62
          notifications.add(notification);
63
          notifications.dispatch();
63
          notifications.dispatch();
64
        }
64
        }
65
      }
65
      }
66
      return oldObject;
66
      return oldObject;
67
    }
67
    }
68
    else
68
    else
69
    {
69
    {
70
      E oldObject = doSetUnique(index, object);
70
      E oldObject = doSetUnique(index, object);
71
      if (hasInverse() && !equalObjects(oldObject, object))
71
      if (hasInverse() && !equalObjects(oldObject, object))
72
      {
72
      {
73
        NotificationChain notifications = null;
73
        NotificationChain notifications = null;
74
        if (oldObject != null)
74
        if (oldObject != null)
75
        {
75
        {
76
          notifications = inverseRemove(oldObject, null);
76
          notifications = inverseRemove(oldObject, null);
77
        }
77
        }
78
        notifications = inverseAdd(object, notifications);
78
        notifications = inverseAdd(object, notifications);
79
        if (notifications != null) notifications.dispatch();
79
        if (notifications != null) notifications.dispatch();
80
      }
80
      }
81
      return oldObject;
81
      return oldObject;
82
    }
82
    }
83
  }
83
  }
84
  /**
84
  /**
85
   * Sets the object at the index
85
   * Sets the object at the index
86
   * and returns the old object at the index;
86
   * and returns the old object at the index;
87
   * it does no ranging checking, uniqueness checking, inverse updating or notification.
87
   * it does no ranging checking, uniqueness checking, inverse updating or notification.
88
   * @param index the position in question.
88
   * @param index the position in question.
89
   * @param object the object to set.
89
   * @param object the object to set.
90
   * @return the old object at the index.
90
   * @return the old object at the index.
91
   */
91
   */
92
  protected E doSetUnique(int index, E object)
92
  protected E doSetUnique(int index, E object)
93
  {
93
  {
94
    return super.setUnique(index, object);
94
    return super.setUnique(index, object);
95
  }
95
  }
96
  /**
96
  /**
97
   * Sets the object at the index
97
   * Sets the object at the index
98
   * and returns the potentially updated notification chain;
98
   * and returns the potentially updated notification chain;
99
   * it does no {@link #hasInverse inverse} updating.
99
   * it does no {@link #hasInverse inverse} updating.
100
   * This implementation generates notifications as {@link #isNotificationRequired required}.
100
   * This implementation generates notifications as {@link #isNotificationRequired required}.
101
   * @param index the position in question.
101
   * @param index the position in question.
102
   * @param object the object to set.
102
   * @param object the object to set.
103
   * @return the notification chain.
103
   * @return the notification chain.
104
   * @see #isNotificationRequired
104
   * @see #isNotificationRequired
105
   * @see #hasInverse
105
   * @see #hasInverse
106
   * @see #inverseAdd
106
   * @see #inverseAdd
107
   * @see #inverseRemove
107
   * @see #inverseRemove
108
   */
108
   */
109
  public NotificationChain basicSet(int index, E object, NotificationChain notifications)
109
  public NotificationChain basicSet(int index, E object, NotificationChain notifications)
110
  {
110
  {
111
    if (isNotificationRequired())
111
    if (isNotificationRequired())
112
    {
112
    {
113
      boolean oldIsSet = isSet();
113
      boolean oldIsSet = isSet();
114
      NotificationImpl notification = 
114
      NotificationImpl notification = 
115
        createNotification(Notification.SET, doSetUnique(index, object), object, index, oldIsSet);
115
createNotification(Notification.SET, doSetUnique(index, object), object, index, oldIsSet);
116
      if (notifications == null) 
116
      if (notifications == null) 
117
      {
117
      {
118
        notifications = notification;
118
        notifications = notification;
119
      }
119
      }
120
      else
120
      else
121
      {
121
      {
122
        notifications.add(notification);
122
        notifications.add(notification);
123
      }
123
      }
124
    }
124
    }
125
    else
125
    else
126
    {
126
    {
127
      doSetUnique(index, object);
127
      doSetUnique(index, object);
128
    }
128
    }
129
    return notifications;
129
    return notifications;
130
  }
130
  }
131
  /**
131
  /**
132
   * Moves the object at the source index of the list to the target index of the list
132
   * Moves the object at the source index of the list to the target index of the list
133
   * and returns the moved object.
133
   * and returns the moved object.
134
   * In addition to the normal effects, 
134
   * In addition to the normal effects, 
135
   * this override implementation generates notifications as {@link #isNotificationRequired required}.
135
   * this override implementation generates notifications as {@link #isNotificationRequired required}.
136
   * @param targetIndex the new position for the object in the list.
136
   * @param targetIndex the new position for the object in the list.
137
   * @param sourceIndex the old position of the object in the list.
137
   * @param sourceIndex the old position of the object in the list.
138
   * @return the moved object.
138
   * @return the moved object.
139
   * @exception IndexOutOfBoundsException if either index isn't within the size range.
139
   * @exception IndexOutOfBoundsException if either index isn't within the size range.
140
   * @see #isNotificationRequired
140
   * @see #isNotificationRequired
141
   */
141
   */
142
  @Override
142
  @Override
143
  public E move(int targetIndex, int sourceIndex)
143
  public E move(int targetIndex, int sourceIndex)
144
  {
144
  {
145
    if (isNotificationRequired())
145
    if (isNotificationRequired())
146
    {
146
    {
147
      boolean oldIsSet = isSet();
147
      boolean oldIsSet = isSet();
148
      E object = doMove(targetIndex, sourceIndex);
148
      E object = doMove(targetIndex, sourceIndex);
149
      dispatchNotification
149
      dispatchNotification
150
        (createNotification
150
        (createNotification
151
           (Notification.MOVE, 
151
           (Notification.MOVE, 
152
            sourceIndex,
152
            sourceIndex,
153
            object, 
153
            object, 
154
            targetIndex,
154
            targetIndex,
155
            oldIsSet));
155
            oldIsSet));
156
      return object;
156
      return object;
157
    }
157
    }
158
    else
158
    else
159
    {
159
    {
160
      return doMove(targetIndex, sourceIndex);
160
      return doMove(targetIndex, sourceIndex);
161
    }
161
    }
162
  }
162
  }
163
  /**
163
  /**
164
   * Moves the object at the source index of the list to the target index of the list
164
   * Moves the object at the source index of the list to the target index of the list
165
   * and returns the moved object;
165
   * and returns the moved object;
166
   * it does no notification.
166
   * it does no notification.
167
   * @param targetIndex the new position for the object in the list.
167
   * @param targetIndex the new position for the object in the list.
168
   * @param sourceIndex the old position of the object in the list.
168
   * @param sourceIndex the old position of the object in the list.
169
   * @return the moved object.
169
   * @return the moved object.
170
   * @exception IndexOutOfBoundsException if either index isn't within the size range.
170
   * @exception IndexOutOfBoundsException if either index isn't within the size range.
171
   */
171
   */
172
  protected E doMove(int targetIndex, int sourceIndex)
172
  protected E doMove(int targetIndex, int sourceIndex)
173
  {
173
  {
174
    return super.move(targetIndex, sourceIndex);
174
    return super.move(targetIndex, sourceIndex);
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