/**
* Adds each object from start to end of the array at each successive index in the list
* and returns whether any objects were added;
* it does no ranging checking, uniqueness checking, inverse updating, or notification.
* @param index the index at which to add.
* @param objects the objects to be added.
* @param start the index of first object to be added.
* @param end the index past the last object to be added.
* @return whether any objects were added.
*/
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 = [[#variable146aabc0]];
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( [[#variable146aabc0]], 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);
}
|