/**
* Creates an instance that is a copy of the collection.
* @param collection the initial contents of the list.
*/
public [[#variable1470cc00]](Collection<? extends E> collection) {
super(collection);
}
/**
* Returns <code>null</code>.
* @return <code>null</code>.
*/
public Object getNotifier() {
return null;
}
/**
* Returns <code>null</code>.
* @return <code>null</code>.
*/
public Object getFeature() {
return null;
}
/**
* Returns {@link Notification#NO_FEATURE_ID}.
* @return <code>Notification.NO_FEATURE_ID</code>.
*/
/**
* Returns {@link org.eclipse.emf.common.notify.Notification#NO_FEATURE_ID}.
* @return <code>Notification.NO_FEATURE_ID</code>.
*/
public int getFeatureID() {
return Notification.NO_FEATURE_ID;
}
/**
* Returns the result of calling {@link #getFeatureID()}.
* @param expectedClass the class to which the ID is relative.
* @return <code>getFeatureID()</code>.
*/
protected int getFeatureID(Class<? > expectedClass) {
return getFeatureID();
}
/**
* Returns whether the list is considered set, i.e., whether it's not empty.
* A derived implementation may model this state directly.
* @return whether the list is considered set.
*/
protected boolean isSet() {
return !isEmpty();
}
/**
* Returns <code>false</code>.
* @return <code>false</code>.
*/
protected boolean hasInverse() {
return false;
}
/**
* Returns <code>!{@link #hasInverse()}</code>.
* @return <code>!hasInverse</code>.
*/
@Override protected boolean canContainNull() {
return !hasInverse();
}
/**
* Returns <code>false</code>.
* @return <code>false</code>.
*/
protected boolean isNotificationRequired() {
return false;
}
/**
* Returns <code>false</code>.
* @return <code>false</code>.
*/
protected boolean hasShadow() {
return false;
}
/**
* Does nothing and returns the <code>notifications</code>.
* Clients can override this to update the inverse of a bidirectional relation.
* @param object the object that's been added to the list.
* @param notifications the chain of accumulating notifications.
* @return the <code>notifications</code>.
*/
protected NotificationChain shadowAdd(E object, NotificationChain notifications) {
return notifications;
}
/**
* Does nothing and returns the <code>notifications</code>.
* Clients can override this to update the inverse of a bidirectional relation.
* @param object the object that's been remove from the list.
* @param notifications the chain of accumulating notifications.
* @return the <code>notifications</code>.
*/
protected NotificationChain shadowRemove(E object, NotificationChain notifications) {
return notifications;
}
/**
* Does nothing and returns the <code>notifications</code>.
* Clients can override this to update the inverse of a bidirectional relation.
* @param oldObject the object that's been removed from the list.
* @param newObject the object that's been added to the list.
* @param notifications the chain of accumulating notifications.
* @return the <code>notifications</code>.
*/
protected NotificationChain shadowSet(E oldObject, E newObject, NotificationChain notifications) {
return notifications;
}
/**
* Does nothing and returns the <code>notifications</code>.
* Clients can override this to update the inverse of a bidirectional relation.
* @param object the object that's been added to the list.
* @param notifications the chain of accumulating notifications.
* @return the <code>notifications</code>.
*/
protected NotificationChain inverseAdd(E object, NotificationChain notifications) {
return notifications;
}
/**
* Does nothing and returns the <code>notifications</code>.
* Clients can override this to update the inverse of a bidirectional relation.
* @param object the object that's been remove from the list.
* @param notifications the chain of accumulating notifications.
* @return the <code>notifications</code>.
*/
protected NotificationChain inverseRemove(E object, NotificationChain notifications) {
return notifications;
}
/*
* @deprecated
*/
protected NotificationImpl createNotification(int eventType, Object oldObject, Object newObject, int index) {
throw new UnsupportedOperationException("Please change your code to call new five argument version of this method");
}
/**
* Creates a notification.
* @param eventType the type of change that has occurred.
* @param oldObject the value of the notifier's feature before the change occurred.
* @param newObject the value of the notifier's feature after the change occurred.
* @param index the position at which the change occurred.
* @return a new notification.
*/
protected NotificationImpl createNotification(int eventType, Object oldObject, Object newObject, int index, boolean wasSet) {
return new NotificationImpl(eventType, oldObject, newObject, index, wasSet) {
@Override public Object getNotifier() {
return [[#variable1470cc00]].this.getNotifier();
}
@Override public Object getFeature() {
return [[#variable1470cc00]].this.getFeature();
}
@Override public int getFeatureID(Class<? > expectedClass) {
return [[#variable1470cc00]].this.getFeatureID(expectedClass);
}
};
}
/**
* Creates a notification chain, if the expected capacity exceeds the threshold
* at which a list is better than chaining individual notification instances.
*/
protected NotificationChain createNotificationChain(int capacity) {
return capacity < 100 ? null: new NotificationChainImpl(capacity);
}
/**
* Dispatches a notification to the notifier of the list.
* @param notification the notification to dispatch.
*/
protected void dispatchNotification(Notification notification) {
((Notifier) getNotifier()).eNotify(notification);
}
/**
* Adds the object at the end of the list;
* it does no uniqueness checking.
* In addition to the normal effects,
* this override implementation generates notifications as {@link #isNotificationRequired required}
* and delegates to {@link #inverseAdd inverseAdd} as {@link #hasInverse required}.
* @param object the object to be added.
* @see #isNotificationRequired
* @see #hasInverse
* @see #inverseAdd
*/
@Override public void addUnique(E object) {
if (isNotificationRequired()) {
int index = [[#variable1470cae0]];
boolean oldIsSet = isSet();
doAddUnique( [[#variable1470caa0]]);
NotificationImpl notification = createNotification(Notification.ADD, null, object, index, oldIsSet);
if (hasInverse()) {
NotificationChain notifications = inverseAdd(object, null);
if (hasShadow()) {
notifications = shadowAdd(object, notifications);
}
if (notifications == null) {
dispatchNotification(notification);
}
else {
notifications.add(notification);
notifications.dispatch();
}
}
else {
dispatchNotification(notification);
}
}
else {
doAddUnique(object);
if (hasInverse()) {
NotificationChain notifications = inverseAdd(object, null);
if (notifications != null)
notifications.dispatch();
}
}
}
/**
* Adds the object at the end of the list;
* it does no uniqueness checking, inverse updating, or notification.
* @param object the object to be added.
*/
protected void doAddUnique(E object) {
super.addUnique(object);
}
/**
* Adds the object at the given index in the list;
* 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} as {@link #hasInverse required}.
* @param object the object to be added.
* @see #isNotificationRequired
* @see #hasInverse
* @see #inverseAdd
*/
@Override public void addUnique(int index, E object) {
if (isNotificationRequired()) {
boolean oldIsSet = isSet();
doAddUnique(index, object);
NotificationImpl notification = createNotification(Notification.ADD, null, object, index, oldIsSet);
if (hasInverse()) {
NotificationChain notifications = inverseAdd(object, null);
if (hasShadow()) {
notifications = shadowAdd(object, notifications);
}
if (notifications == null) {
dispatchNotification(notification);
}
else {
notifications.add(notification);
notifications.dispatch();
}
}
else {
dispatchNotification(notification);
}
}
else {
doAddUnique(index, object);
if (hasInverse()) {
NotificationChain notifications = inverseAdd(object, null);
if (notifications != null)
notifications.dispatch();
}
}
}
/**
* Adds the object at the given index in the list;
* it does no range checking, uniqueness checking, inverse updating, or notification.
* @param object the object to be added.
*/
protected void doAddUnique(int index, E object) {
super.addUnique(index, object);
}
/**
* Adds each object of the collection to the end of the list;
* it does no uniqueness checking.
* This implementation delegates to {@link #addAllUnique(int, Collection) addAllUnique(int, Collection)}.
* @param collection the collection of objects to be added.
* @see #inverseAdd
*/
@Override public boolean addAllUnique(Collection<? extends E> collection) {
return addAllUnique( [[#variable1470cae0]], collection);
}
/**
* Adds each object of the collection to the end of the list;
* it does no uniqueness checking, inverse updating, or notification.
* @param collection the collection of objects to be added.
*/
protected boolean doAddAllUnique(Collection<? extends E> collection) {
return super.addAllUnique(collection);
}
|