Package com.nomagic.magicdraw.uml2.util
Class ModelEObjectEList<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- org.eclipse.emf.common.util.AbstractEList<E>
-
- org.eclipse.emf.common.util.BasicEList<E>
-
- org.eclipse.emf.common.notify.impl.NotifyingListImpl<E>
-
- org.eclipse.emf.ecore.util.NotifyingInternalEListImpl<E>
-
- org.eclipse.emf.ecore.util.EcoreEList<E>
-
- org.eclipse.emf.ecore.util.EObjectEList<E>
-
- com.nomagic.magicdraw.uml2.util.ModelEObjectEList<E>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.List<E>
,java.util.RandomAccess
,org.eclipse.emf.common.notify.NotifyingList<E>
,org.eclipse.emf.common.util.EList<E>
,org.eclipse.emf.ecore.EStructuralFeature.Setting
,org.eclipse.emf.ecore.util.InternalEList<E>
,org.eclipse.emf.ecore.util.InternalEList.Unsettable<E>
- Direct Known Subclasses:
ModelEObjectResolvingEList
,SubsetSupersetEObjectEList
public class ModelEObjectEList<E> extends org.eclipse.emf.ecore.util.EObjectEList<E>
Base class for all transient collections of the model.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.emf.ecore.util.EObjectEList
org.eclipse.emf.ecore.util.EObjectEList.Unsettable<E extends java.lang.Object>
-
Nested classes/interfaces inherited from class org.eclipse.emf.ecore.util.EcoreEList
org.eclipse.emf.ecore.util.EcoreEList.Dynamic<E extends java.lang.Object>, org.eclipse.emf.ecore.util.EcoreEList.Generic<E extends java.lang.Object>, org.eclipse.emf.ecore.util.EcoreEList.UnmodifiableEList<E extends java.lang.Object>
-
Nested classes/interfaces inherited from class org.eclipse.emf.common.util.BasicEList
org.eclipse.emf.common.util.BasicEList.BasicIndexOutOfBoundsException, org.eclipse.emf.common.util.BasicEList.EIterator<E1 extends java.lang.Object>, org.eclipse.emf.common.util.BasicEList.EListIterator<E1 extends java.lang.Object>, org.eclipse.emf.common.util.BasicEList.FastCompare<E extends java.lang.Object>, org.eclipse.emf.common.util.BasicEList.NonResolvingEIterator<E1 extends java.lang.Object>, org.eclipse.emf.common.util.BasicEList.NonResolvingEListIterator<E1 extends java.lang.Object>
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
Serial version id.private static SingleThreadLocalMarker
suppressNotifications
-
Constructor Summary
Constructors Constructor Description ModelEObjectEList(java.lang.Class<?> dataClass, org.eclipse.emf.ecore.InternalEObject owner, int featureID)
Creates and initializes a newModelEObjectEList
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.void
addUnique(int index, E object)
Adds the object at the given index in the list; it does no ranging checking or uniqueness checking.void
addUnique(E object)
Adds the object at the end of the list; it does no uniqueness checking.void
addUniqueSuppressNotifications(E object)
protected void
afterChange()
The method will be invoked after property change.protected E
assign(int index, E object)
Assigns the object into the data storage at the given index and returns the object that's been stored.org.eclipse.emf.common.notify.NotificationChain
basicAdd(E object, org.eclipse.emf.common.notify.NotificationChain notifications)
boolean
basicContains(java.lang.Object object)
boolean
basicContainsAll(java.util.Collection<?> collection)
E
basicGet(int index)
int
basicIndexOf(java.lang.Object object)
int
basicLastIndexOf(java.lang.Object object)
java.util.List<E>
basicList()
java.lang.Object[]
basicToArray()
<T> T[]
basicToArray(T[] array)
protected void
beforeChange(java.lang.String featureName)
The method will be invoked before specified property change.void
clear()
Clears the list of all objects.boolean
contains(java.lang.Object object)
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.private E
doMoveInternal(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 void
firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue, int index)
Implementation must fire property change event.protected void
firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue, int index, int newIndex)
Implementation must fire property change event.E
get(int index)
protected java.lang.String
getPropertyEventName(java.lang.Object value)
Returns name property change event.protected boolean
hasInverse()
protected boolean
hasManyInverse()
protected boolean
hasNavigableInverse()
int
indexOf(java.lang.Object object)
boolean
isEmpty()
protected boolean
isRawMode()
Method should return true if event support is in raw mode.int
lastIndexOf(java.lang.Object object)
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.protected E
primitiveGet(int index)
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.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.int
size()
protected void
startLogEvents()
Starts logging of events.protected void
stopLogEvents()
Stops logging of events.protected E
validate(int index, E object)
Validates a new content object and returns the validated object.-
Methods inherited from class org.eclipse.emf.ecore.util.EObjectEList
canContainNull, getFeatureID, isEObject, isUnique, resolve, useEquals
-
Methods inherited from class org.eclipse.emf.ecore.util.EcoreEList
createNotification, createNotification, dispatchNotification, get, getEObject, getEStructuralFeature, getFeature, getFeatureType, getInverseEReference, getInverseFeatureClass, getInverseFeatureID, getNotifier, hasInstanceClass, hasProxies, inverseAdd, inverseRemove, isContainment, isInstance, isNotificationRequired, isSet, newData, resolve, resolve, resolveProxy, set, toArray, toArray, unset
-
Methods inherited from class org.eclipse.emf.ecore.util.NotifyingInternalEListImpl
basicIterator, basicListIterator, basicListIterator
-
Methods inherited from class org.eclipse.emf.common.notify.impl.NotifyingListImpl
addAllUnique, addAllUnique, addAllUnique, basicRemove, basicSet, createNotification, createNotificationChain, doAddAllUnique, doAddAllUnique, doAddAllUnique, doAddAllUnique, doAddUnique, doAddUnique, doClear, doRemoveAll, doSetUnique, getFeatureID, hasShadow, shadowAdd, shadowRemove, shadowSet
-
Methods inherited from class org.eclipse.emf.common.util.BasicEList
clone, data, grow, setData, shrink
-
Methods inherited from class org.eclipse.emf.common.util.AbstractEList
add, add, addAll, addAll, didAdd, didChange, didClear, didMove, didRemove, didSet, equalObjects, equals, getDuplicates, getNonDuplicates, hashCode, iterator, listIterator, listIterator, move, remove, retainAll, set, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serial version id.- See Also:
- Constant Field Values
-
suppressNotifications
private static final SingleThreadLocalMarker suppressNotifications
-
-
Constructor Detail
-
ModelEObjectEList
public ModelEObjectEList(java.lang.Class<?> dataClass, org.eclipse.emf.ecore.InternalEObject owner, int featureID)
Creates and initializes a newModelEObjectEList
instance.- Parameters:
dataClass
- data class.owner
- owner of the setting.featureID
- feature id.
-
-
Method Detail
-
getPropertyEventName
protected java.lang.String getPropertyEventName(java.lang.Object value)
Returns name property change event.- Parameters:
value
- value that was changed.- Returns:
- property name.
-
beforeChange
protected final void beforeChange(java.lang.String featureName)
The method will be invoked before specified property change.- Parameters:
featureName
- name of the feature.
-
afterChange
protected final void afterChange()
The method will be invoked after property change.
-
startLogEvents
protected final void startLogEvents()
Starts logging of events.
-
stopLogEvents
protected final void stopLogEvents()
Stops logging of events.
-
firePropertyChange
protected void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue, int index)
Implementation must fire property change event.- Parameters:
propertyName
- name of the changed property.oldValue
- old value of the property.newValue
- new value of the property.index
- index of the new value.
-
firePropertyChange
protected void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue, int index, int newIndex)
Implementation must fire property change event.- Parameters:
propertyName
- name of the changed property.oldValue
- old value of the property.newValue
- new value of the property.index
- index of the new value.newIndex
- new index of the value
-
isRawMode
protected final boolean isRawMode()
Method should return true if event support is in raw mode.- Returns:
- true if raw mode.
-
assign
protected final E assign(int index, E object)
Assigns the object into the data storage at the given index and returns the object that's been stored. Clients can monitor access to the storage via this method.- Overrides:
assign
in classorg.eclipse.emf.common.util.BasicEList<E>
- Parameters:
index
- the position of the new content.object
- the new content.- Returns:
- the object that's been stored.
-
addUniqueSuppressNotifications
public void addUniqueSuppressNotifications(E object)
-
doRemove
protected E doRemove(int index)
Removes the object at the index from the list and returns it; it does no inverse updating, or notification.- Overrides:
doRemove
in classorg.eclipse.emf.common.notify.impl.NotifyingListImpl<E>
- Parameters:
index
- the position of the object to remove.- Returns:
- the removed object.
- Throws:
java.lang.IndexOutOfBoundsException
- if the index isn't within the size range.
-
clear
public void clear()
Clears the list of all objects. In addition to the normal effects, this override implementation generates notifications asrequired
and delegates toEcoreEList.inverseRemove(Object, org.eclipse.emf.common.notify.NotificationChain)
asrequired
.- Specified by:
clear
in interfacejava.util.Collection<E>
- Specified by:
clear
in interfacejava.util.List<E>
- Overrides:
clear
in classorg.eclipse.emf.common.notify.impl.NotifyingListImpl<E>
- See Also:
EcoreEList.isNotificationRequired()
,hasInverse()
,EcoreEList.inverseRemove(Object, org.eclipse.emf.common.notify.NotificationChain)
-
hasInverse
protected boolean hasInverse()
- Overrides:
hasInverse
in classorg.eclipse.emf.ecore.util.EObjectEList<E>
-
hasNavigableInverse
protected boolean hasNavigableInverse()
- Overrides:
hasNavigableInverse
in classorg.eclipse.emf.ecore.util.EcoreEList<E>
-
hasManyInverse
protected boolean hasManyInverse()
- Overrides:
hasManyInverse
in classorg.eclipse.emf.ecore.util.EcoreEList<E>
-
addUnique
public void addUnique(E object)
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 asrequired
and delegates toinverseAdd
asrequired
.- Specified by:
addUnique
in interfaceorg.eclipse.emf.ecore.util.InternalEList<E>
- Overrides:
addUnique
in classorg.eclipse.emf.common.notify.impl.NotifyingListImpl<E>
- Parameters:
object
- the object to be added.- See Also:
EcoreEList.isNotificationRequired()
,hasInverse()
,EcoreEList.inverseAdd(E, org.eclipse.emf.common.notify.NotificationChain)
-
validate
protected E validate(int index, E object)
Validates a new content object and returns the validated object. This implementation checks for null, ifnecessary
and returns the argument object. Clients may throw additional types of runtime exceptions in order to handle constraint violations.- Overrides:
validate
in classorg.eclipse.emf.ecore.util.EcoreEList<E>
- Parameters:
index
- the position of the new content.object
- the new content.- Returns:
- the validated content.
- Throws:
java.lang.IllegalArgumentException
- if a constraint prevents the object from being added.
-
addUnique
public void addUnique(int index, E 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 asrequired
and delegates toinverseAdd
asrequired
.- Specified by:
addUnique
in interfaceorg.eclipse.emf.ecore.util.InternalEList<E>
- Overrides:
addUnique
in classorg.eclipse.emf.common.notify.impl.NotifyingListImpl<E>
- Parameters:
object
- the object to be added.- See Also:
EcoreEList.isNotificationRequired()
,hasInverse()
,EcoreEList.inverseAdd(E, org.eclipse.emf.common.notify.NotificationChain)
-
setUnique
public 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. In addition to the normal effects, this override implementation generates notifications asrequired
and delegates toinverseAdd
andinverseRemove
asrequired
.- Specified by:
setUnique
in interfaceorg.eclipse.emf.ecore.util.InternalEList<E>
- Overrides:
setUnique
in classorg.eclipse.emf.common.notify.impl.NotifyingListImpl<E>
- Parameters:
index
- the position in question.object
- the object to set.- Returns:
- the old object at the index.
- See Also:
EcoreEList.isNotificationRequired()
,hasInverse()
,EcoreEList.inverseAdd(E, org.eclipse.emf.common.notify.NotificationChain)
,EcoreEList.inverseRemove(E, org.eclipse.emf.common.notify.NotificationChain)
-
move
public 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. In addition to the normal effects, this override implementation generates notifications asrequired
.- Specified by:
move
in interfaceorg.eclipse.emf.common.util.EList<E>
- Overrides:
move
in classorg.eclipse.emf.common.notify.impl.NotifyingListImpl<E>
- Parameters:
targetIndex
- the new position for the object in the list.sourceIndex
- the old position of the object in the list.- Returns:
- the moved object.
- Throws:
java.lang.IndexOutOfBoundsException
- if either index isn't within the size range.- See Also:
EcoreEList.isNotificationRequired()
-
addAllUnique
public 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. In addition to the normal effects, this override implementation generates notifications asrequired
and delegates toinverseAdd
asrequired
.- Specified by:
addAllUnique
in interfaceorg.eclipse.emf.ecore.util.InternalEList<E>
- Overrides:
addAllUnique
in classorg.eclipse.emf.common.notify.impl.NotifyingListImpl<E>
- Parameters:
index
- the index at which to add.collection
- the collection of objects to be added.- Returns:
- whether any objects were added.
- See Also:
EcoreEList.isNotificationRequired()
,hasInverse()
,EcoreEList.inverseAdd(E, org.eclipse.emf.common.notify.NotificationChain)
-
remove
public E remove(int index)
Removes the object at the index from the list and returns it. In addition to the normal effects, this override implementation generates notifications asrequired
and delegates toinverseRemove
asrequired
.- Specified by:
remove
in interfacejava.util.List<E>
- Overrides:
remove
in classorg.eclipse.emf.common.notify.impl.NotifyingListImpl<E>
- Parameters:
index
- the position of the object to remove.- Returns:
- the removed object.
- Throws:
java.lang.IndexOutOfBoundsException
- if the index isn't within the size range.- See Also:
EcoreEList.isNotificationRequired()
,hasInverse()
,EcoreEList.inverseRemove(E, org.eclipse.emf.common.notify.NotificationChain)
-
removeAll
public 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. In addition to the normal effects, this override implementation generates notifications asrequired
and delegates toinverseRemove
asrequired
.- Specified by:
removeAll
in interfacejava.util.Collection<E>
- Specified by:
removeAll
in interfacejava.util.List<E>
- Overrides:
removeAll
in classorg.eclipse.emf.common.notify.impl.NotifyingListImpl<E>
- Parameters:
collection
- the collection of objects to be removed.- Returns:
- whether any object was actually contained by the list.
- See Also:
EcoreEList.isNotificationRequired()
,hasInverse()
,EcoreEList.inverseRemove(E, org.eclipse.emf.common.notify.NotificationChain)
-
basicGet
public E basicGet(int index)
-
basicList
public java.util.List<E> basicList()
-
basicToArray
public java.lang.Object[] basicToArray()
-
basicToArray
public <T> T[] basicToArray(T[] array)
-
size
public int size()
-
basicIndexOf
public int basicIndexOf(java.lang.Object object)
-
basicLastIndexOf
public int basicLastIndexOf(java.lang.Object object)
-
basicContains
public boolean basicContains(java.lang.Object object)
-
basicContainsAll
public boolean basicContainsAll(java.util.Collection<?> collection)
-
indexOf
public int indexOf(java.lang.Object object)
-
contains
public boolean contains(java.lang.Object object)
-
basicAdd
public org.eclipse.emf.common.notify.NotificationChain basicAdd(E object, org.eclipse.emf.common.notify.NotificationChain notifications)
-
get
public E get(int index)
-
isEmpty
public boolean isEmpty()
-
lastIndexOf
public int lastIndexOf(java.lang.Object object)
-
primitiveGet
protected E primitiveGet(int index)
- Overrides:
primitiveGet
in classorg.eclipse.emf.common.util.BasicEList<E>
-
doMove
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.- Overrides:
doMove
in classorg.eclipse.emf.common.notify.impl.NotifyingListImpl<E>
- Parameters:
targetIndex
- the new position for the object in the list.sourceIndex
- the old position of the object in the list.- Returns:
- the moved object.
- Throws:
java.lang.IndexOutOfBoundsException
- if either index isn't within the size range.
-
doMoveInternal
private E doMoveInternal(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.- Parameters:
targetIndex
- the new position for the object in the list.sourceIndex
- the old position of the object in the list.- Returns:
- the moved object.
-
-