public abstract class DelegatingNotifyingListImpl<E> extends DelegatingEList<E> implements NotifyingList<E>
DelegatingEList.EIterator<E1>, DelegatingEList.EListIterator<E1>, DelegatingEList.NonResolvingEIterator<E1>, DelegatingEList.NonResolvingEListIterator<E1>, DelegatingEList.UnmodifiableEList<E>
AbstractEList.BasicIndexOutOfBoundsException
Constructor and Description |
---|
DelegatingNotifyingListImpl()
Creates an empty instance.
|
DelegatingNotifyingListImpl(java.util.Collection<? extends E> collection)
Creates an instance that is a copy of the collection.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addAllUnique(java.util.Collection<? extends E> collection)
Adds each object of the collection to the end of the list;
it does no uniqueness checking.
|
boolean |
addAllUnique(int index,
java.util.Collection<? extends E> collection)
Adds each object of the collection at each successive index in the list
and returns whether any objects were added;
it does no ranging checking or uniqueness checking.
|
boolean |
addAllUnique(int index,
java.lang.Object[] objects,
int start,
int end)
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 or uniqueness checking.
|
boolean |
addAllUnique(java.lang.Object[] objects,
int start,
int end)
Adds each object from start to end of the array to the end of the list;
it does no uniqueness checking.
|
void |
addUnique(E object)
Adds the object at the end of the list;
it does no uniqueness checking.
|
void |
addUnique(int index,
E object)
Adds the object at the given index in the list;
it does no ranging checking or uniqueness checking.
|
NotificationChain |
basicAdd(E object,
NotificationChain notifications)
Adds the object at the end of the list and returns the potentially updated notification chain;
it does no
inverse updating. |
NotificationChain |
basicRemove(java.lang.Object object,
NotificationChain notifications)
Removes the object from the list and returns the potentially updated notification chain;
it does no
inverse updating. |
NotificationChain |
basicSet(int index,
E object,
NotificationChain notifications)
Sets the object at the index
and returns the potentially updated notification chain;
it does no
inverse updating. |
protected boolean |
canContainNull()
Returns
! |
void |
clear()
Clears the list of all objects.
|
protected NotificationImpl |
createNotification(int eventType,
java.lang.Object oldObject,
java.lang.Object newObject,
int index) |
protected NotificationImpl |
createNotification(int eventType,
java.lang.Object oldObject,
java.lang.Object newObject,
int index,
boolean wasSet)
Creates a notification.
|
protected NotificationChain |
createNotificationChain(int capacity)
Creates a notification chain, if the expected capacity exceeds the threshold
at which a list is better than chaining individual notification instances.
|
protected void |
dispatchNotification(Notification notification)
Dispatches a notification to the notifier of the list.
|
protected boolean |
doAddAllUnique(java.util.Collection<? extends E> collection)
Adds each object of the collection to the end of the list;
it does no uniqueness checking, inverse updating, or notification.
|
protected boolean |
doAddAllUnique(int index,
java.util.Collection<? extends E> collection)
Adds each object of the collection at each successive index in the list
and returns whether any objects were added;
it does no range checking, uniqueness checking, inverse updating, or notification.
|
protected boolean |
doAddAllUnique(int index,
java.lang.Object[] objects,
int start,
int end)
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.
|
protected boolean |
doAddAllUnique(java.lang.Object[] objects,
int start,
int end)
Adds each object from start to end of the array to the end of the list
and returns whether any objects were added;
it does no ranging checking, uniqueness checking, inverse updating, or notification.
|
protected void |
doAddUnique(E object)
Adds the object at the end of the list;
it does no uniqueness checking, inverse updating, or notification.
|
protected void |
doAddUnique(int index,
E object)
Adds the object at the given index in the list;
it does no range checking, uniqueness checking, inverse updating, or notification.
|
protected void |
doClear()
Clears the list of all objects;
it does no
inverse updating. |
protected E |
doMove(int targetIndex,
int 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.
|
protected E |
doRemove(int index)
Removes the object at the index from the list and returns it;
it does no inverse updating, or notification.
|
protected boolean |
doRemoveAll(java.util.Collection<?> collection)
Removes each object of the collection from the list and returns whether any object was actually contained by the list;
it does no inverse updating, or notification.
|
protected E |
doSetUnique(int index,
E object)
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.
|
java.lang.Object |
getFeature()
Returns
null . |
int |
getFeatureID()
Returns
Notification.NO_FEATURE_ID . |
protected int |
getFeatureID(java.lang.Class<?> expectedClass)
Returns the result of calling
getFeatureID() . |
java.lang.Object |
getNotifier()
Returns
null . |
protected boolean |
hasInverse()
Returns
false . |
protected boolean |
hasShadow()
Returns
false . |
protected NotificationChain |
inverseAdd(E object,
NotificationChain notifications)
Does nothing and returns the
notifications . |
protected NotificationChain |
inverseRemove(E object,
NotificationChain notifications)
Does nothing and returns the
notifications . |
protected boolean |
isNotificationRequired()
Returns
false . |
protected boolean |
isSet()
Returns whether the list is considered set, i.e., whether it's not empty.
|
E |
move(int targetIndex,
int sourceIndex)
Moves the object at the source index of the list to the target index of the list
and returns the moved object.
|
E |
remove(int index)
Removes the object at the index from the list and returns it.
|
boolean |
removeAll(java.util.Collection<?> collection)
Removes each object of the collection from the list and returns whether any object was actually contained by the list.
|
protected E |
resolve(E object)
Returns the resolved object from this list for the purpose of testing whether
removeAll(Collection) applies to it. |
E |
setUnique(int index,
E object)
Sets the object at the index
and returns the old object at the index;
it does no ranging checking or uniqueness checking.
|
protected NotificationChain |
shadowAdd(E object,
NotificationChain notifications)
Does nothing and returns the
notifications . |
protected NotificationChain |
shadowRemove(E object,
NotificationChain notifications)
Does nothing and returns the
notifications . |
protected NotificationChain |
shadowSet(E oldObject,
E newObject,
NotificationChain notifications)
Does nothing and returns the
notifications . |
basicGet, basicList, contains, containsAll, delegateAdd, delegateAdd, delegateBasicList, delegateClear, delegateContains, delegateContainsAll, delegateEquals, delegateGet, delegateHashCode, delegateIndexOf, delegateIsEmpty, delegateIterator, delegateLastIndexOf, delegateList, delegateListIterator, delegateMove, delegateRemove, delegateSet, delegateSize, delegateToArray, delegateToArray, delegateToString, doClear, equals, get, hashCode, indexOf, isEmpty, lastIndexOf, primitiveGet, remove, retainAll, size, toArray, toArray, toString
add, add, addAll, addAll, basicIterator, basicListIterator, basicListIterator, didAdd, didChange, didClear, didMove, didRemove, didSet, equalObjects, getDuplicates, getNonDuplicates, isUnique, iterator, listIterator, listIterator, move, resolve, set, useEquals, validate
public DelegatingNotifyingListImpl()
public DelegatingNotifyingListImpl(java.util.Collection<? extends E> collection)
collection
- the initial contents of the list.public java.lang.Object getNotifier()
null
.getNotifier
in interface NotifyingList<E>
null
.public java.lang.Object getFeature()
null
.getFeature
in interface NotifyingList<E>
null
.Notification.getFeature()
public int getFeatureID()
Notification.NO_FEATURE_ID
.getFeatureID
in interface NotifyingList<E>
Notification.NO_FEATURE_ID
.Notification.getFeatureID(java.lang.Class<?>)
protected int getFeatureID(java.lang.Class<?> expectedClass)
getFeatureID()
.expectedClass
- the class to which the ID is relative.getFeatureID()
.protected boolean isSet()
protected boolean hasInverse()
false
.false
.protected boolean canContainNull()
!hasInverse()
.canContainNull
in class AbstractEList<E>
!hasInverse
.protected boolean isNotificationRequired()
false
.false
.protected boolean hasShadow()
false
.false
.protected NotificationChain shadowAdd(E object, NotificationChain notifications)
notifications
.
Clients can override this to update the inverse of a bidirectional relation.object
- the object that's been added to the list.notifications
- the chain of accumulating notifications.notifications
.protected NotificationChain shadowRemove(E object, NotificationChain notifications)
notifications
.
Clients can override this to update the inverse of a bidirectional relation.object
- the object that's been remove from the list.notifications
- the chain of accumulating notifications.notifications
.protected NotificationChain shadowSet(E oldObject, E newObject, NotificationChain notifications)
notifications
.
Clients can override this to update the inverse of a bidirectional relation.oldObject
- the object that's been removed from the list.newObject
- the object that's been added to the list.notifications
- the chain of accumulating notifications.notifications
.protected NotificationChain inverseAdd(E object, NotificationChain notifications)
notifications
.
Clients can override this to update the inverse of a bidirectional relation.object
- the object that's been added to the list.notifications
- the chain of accumulating notifications.notifications
.protected NotificationChain inverseRemove(E object, NotificationChain notifications)
notifications
.
Clients can override this to update the inverse of a bidirectional relation.object
- the object that's been remove from the list.notifications
- the chain of accumulating notifications.notifications
.protected NotificationImpl createNotification(int eventType, java.lang.Object oldObject, java.lang.Object newObject, int index)
protected NotificationImpl createNotification(int eventType, java.lang.Object oldObject, java.lang.Object newObject, int index, boolean wasSet)
eventType
- the type of change that has occurred.oldObject
- the value of the notifier's feature before the change occurred.newObject
- the value of the notifier's feature after the change occurred.index
- the position at which the change occurred.protected NotificationChain createNotificationChain(int capacity)
protected void dispatchNotification(Notification notification)
notification
- the notification to dispatch.public void addUnique(E object)
required
and delegates to inverseAdd
as required
.addUnique
in class DelegatingEList<E>
object
- the object to be added.isNotificationRequired()
,
hasInverse()
,
inverseAdd(E, org.eclipse.emf.common.notify.NotificationChain)
protected void doAddUnique(E object)
object
- the object to be added.public void addUnique(int index, E object)
required
and delegates to inverseAdd
as required
.addUnique
in class DelegatingEList<E>
object
- the object to be added.isNotificationRequired()
,
hasInverse()
,
inverseAdd(E, org.eclipse.emf.common.notify.NotificationChain)
protected void doAddUnique(int index, E object)
object
- the object to be added.public boolean addAllUnique(java.util.Collection<? extends E> collection)
addAllUnique(int, Collection)
.addAllUnique
in class DelegatingEList<E>
collection
- the collection of objects to be added.inverseAdd(E, org.eclipse.emf.common.notify.NotificationChain)
protected boolean doAddAllUnique(java.util.Collection<? extends E> collection)
collection
- the collection of objects to be added.public boolean addAllUnique(int index, java.util.Collection<? extends E> collection)
required
and delegates to inverseAdd
as required
.addAllUnique
in class DelegatingEList<E>
index
- the index at which to add.collection
- the collection of objects to be added.isNotificationRequired()
,
hasInverse()
,
inverseAdd(E, org.eclipse.emf.common.notify.NotificationChain)
protected boolean doAddAllUnique(int index, java.util.Collection<? extends E> collection)
index
- the index at which to add.collection
- the collection of objects to be added.public boolean addAllUnique(java.lang.Object[] objects, int start, int end)
addAllUnique(int, Object[], int, int)
.addAllUnique
in class DelegatingEList<E>
objects
- the objects to be added.start
- the index of first object to be added.end
- the index past the last object to be added.inverseAdd(E, org.eclipse.emf.common.notify.NotificationChain)
protected boolean doAddAllUnique(java.lang.Object[] objects, int start, int end)
objects
- the objects to be added.start
- the index of first object to be added.end
- the index past the last object to be added.public boolean addAllUnique(int index, java.lang.Object[] objects, int start, int end)
required
and delegates to inverseAdd
as required
.addAllUnique
in class DelegatingEList<E>
index
- the index at which to add.objects
- the objects to be added.start
- the index of first object to be added.end
- the index past the last object to be added.addAllUnique(int, Collection)
,
isNotificationRequired()
,
hasInverse()
,
inverseAdd(E, org.eclipse.emf.common.notify.NotificationChain)
protected boolean doAddAllUnique(int index, java.lang.Object[] objects, int start, int end)
index
- the index at which to add.objects
- the objects to be added.start
- the index of first object to be added.end
- the index past the last object to be added.public NotificationChain basicAdd(E object, NotificationChain notifications)
inverse
updating.
This implementation generates notifications as required
.object
- the object to be added.isNotificationRequired()
,
hasInverse()
,
inverseAdd(E, org.eclipse.emf.common.notify.NotificationChain)
public E remove(int index)
required
and delegates to inverseRemove
as required
.remove
in interface java.util.List<E>
remove
in class DelegatingEList<E>
index
- the position of the object to remove.java.lang.IndexOutOfBoundsException
- if the index isn't within the size range.isNotificationRequired()
,
hasInverse()
,
inverseRemove(E, org.eclipse.emf.common.notify.NotificationChain)
protected E doRemove(int index)
index
- the position of the object to remove.java.lang.IndexOutOfBoundsException
- if the index isn't within the size range.public boolean removeAll(java.util.Collection<?> collection)
required
and delegates to inverseRemove
as required
.removeAll
in interface java.util.Collection<E>
removeAll
in interface java.util.List<E>
removeAll
in class DelegatingEList<E>
collection
- the collection of objects to be removed.isNotificationRequired()
,
hasInverse()
,
inverseRemove(E, org.eclipse.emf.common.notify.NotificationChain)
protected E resolve(E object)
removeAll(Collection)
applies to it.object
- the object to be resolved.protected boolean doRemoveAll(java.util.Collection<?> collection)
collection
- the collection of objects to be removed.public NotificationChain basicRemove(java.lang.Object object, NotificationChain notifications)
inverse
updating.
This implementation generates notifications as required
.object
- the object to be removed.isNotificationRequired()
,
hasInverse()
,
inverseRemove(E, org.eclipse.emf.common.notify.NotificationChain)
public void clear()
required
and delegates to inverseRemove
as required
.clear
in interface java.util.Collection<E>
clear
in interface java.util.List<E>
clear
in class DelegatingEList<E>
isNotificationRequired()
,
hasInverse()
,
inverseRemove(E, org.eclipse.emf.common.notify.NotificationChain)
protected void doClear()
inverse
updating.public E setUnique(int index, E object)
required
and delegates to inverseAdd
and inverseRemove
as required
.setUnique
in class DelegatingEList<E>
index
- the position in question.object
- the object to set.isNotificationRequired()
,
hasInverse()
,
inverseAdd(E, org.eclipse.emf.common.notify.NotificationChain)
,
inverseRemove(E, org.eclipse.emf.common.notify.NotificationChain)
protected E doSetUnique(int index, E object)
index
- the position in question.object
- the object to set.public NotificationChain basicSet(int index, E object, NotificationChain notifications)
inverse
updating.
This implementation generates notifications as required
.index
- the position in question.object
- the object to set.isNotificationRequired()
,
hasInverse()
,
inverseAdd(E, org.eclipse.emf.common.notify.NotificationChain)
,
inverseRemove(E, org.eclipse.emf.common.notify.NotificationChain)
public E move(int targetIndex, int sourceIndex)
required
.move
in interface EList<E>
move
in class DelegatingEList<E>
targetIndex
- the new position for the object in the list.sourceIndex
- the old position of the object in the list.java.lang.IndexOutOfBoundsException
- if either index isn't within the size range.isNotificationRequired()
protected E doMove(int targetIndex, int sourceIndex)
targetIndex
- the new position for the object in the list.sourceIndex
- the old position of the object in the list.java.lang.IndexOutOfBoundsException
- if either index isn't within the size range.