org.eclipse.emf.emfstore.internal.common.model.impl
Class NotifiableIdEObjectCollectionImpl

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.BasicNotifierImpl
      extended by org.eclipse.emf.ecore.impl.BasicEObjectImpl
          extended by org.eclipse.emf.ecore.impl.EObjectImpl
              extended by org.eclipse.emf.emfstore.internal.common.model.impl.IdEObjectCollectionImpl
                  extended by org.eclipse.emf.emfstore.internal.common.model.impl.NotifiableIdEObjectCollectionImpl
All Implemented Interfaces:
org.eclipse.emf.common.notify.Notifier, org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.InternalEObject, ESObserver, ESIdToEObjectMapping<ModelElementId>, ESObjectContainer<ModelElementId>, APIDelegate<ESModelElementIdToEObjectMappingImpl>, ESDisposable, IdEObjectCollection, ModelElementIdToEObjectMapping, NotifiableIdEObjectCollection, IdEObjectCollectionChangeObserver
Direct Known Subclasses:
ProjectImpl

public abstract class NotifiableIdEObjectCollectionImpl
extends IdEObjectCollectionImpl
implements NotifiableIdEObjectCollection

A collection that is able of maintaining a list of IdEObjectCollectionChangeObserver.

Author:
koegel, naughton, emueller

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EAdapterList<E extends Object & org.eclipse.emf.common.notify.Adapter>, org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EObservableAdapterList
 
Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.InternalEObject
org.eclipse.emf.ecore.InternalEObject.EStore
 
Field Summary
 
Fields inherited from class org.eclipse.emf.emfstore.internal.common.model.impl.IdEObjectCollectionImpl
MODELELEMENTID_GENERATOR_CLASS_ATTRIBUTE, MODELELEMENTID_GENERATOR_EXTENSIONPOINT
 
Fields inherited from class org.eclipse.emf.ecore.impl.EObjectImpl
ELAST_EOBJECT_FLAG
 
Fields inherited from interface org.eclipse.emf.ecore.InternalEObject
EOPPOSITE_FEATURE_BASE
 
Constructor Summary
NotifiableIdEObjectCollectionImpl(org.eclipse.emf.ecore.xmi.XMIResource xmiResource)
          Constructor.
 
Method Summary
abstract  void addCutElement(org.eclipse.emf.ecore.EObject eObject)
          Add a new cut element.
 void addIdEObjectCollectionChangeObserver(IdEObjectCollectionChangeObserver eObjectChangeObserver)
          Adds an IdEObjectCollectionChangeObserver to the collection.
 void collectionDeleted(IdEObjectCollection collection)
          If the IdEObjectCollection is deleted.
<T extends IdEObjectCollection>
T
copy()
          Copies the current collection.
 EObjectChangeNotifier getChangeNotifier()
          Returns the change notifier attached to this collection.
 void initMapping()
          Initializes the ID caches of the collection, i.e.
 void initMapping(Map<org.eclipse.emf.ecore.EObject,String> eObjectToIdMap, Map<String,org.eclipse.emf.ecore.EObject> idToEObjectMap)
          /** Initializes the ID caches of the project with the given mappings.
 void modelElementAdded(IdEObjectCollection collection, org.eclipse.emf.ecore.EObject eObject)
          Called when the eObject has been added to the collection.
 void modelElementRemoved(IdEObjectCollection projectImpl, org.eclipse.emf.ecore.EObject modelElement)
          Called when the eObject and its siblings have been removed from the collection.
 void notify(org.eclipse.emf.common.notify.Notification notification, IdEObjectCollection project, org.eclipse.emf.ecore.EObject modelElement)
          A notification on a model element of the collection occurred.
 void removeIdEObjectCollectionChangeObserver(IdEObjectCollectionChangeObserver projectChangeObserver)
          Remove an IdEObjectCollectionChangeObserver from the collection.
 void setUndetachable(IdEObjectCollectionChangeObserver observer)
          Make a project change observer undetachable.
 
Methods inherited from class org.eclipse.emf.emfstore.internal.common.model.impl.IdEObjectCollectionImpl
addModelElement, allocateModelElementIds, clearAllocatedCaches, contains, contains, deleteModelElement, disallocateModelElementIds, dispose, get, getAllModelElements, getAllModelElementsByClass, getAllModelElementsByClass, getAllModelElementsByClass, getAllModelElementsByClass, getDeletedModelElement, getDeletedModelElementId, getEObjectId, getEObjectToIdMapping, getIdToEObjectMapping, getModelElement, getModelElementId, getModelElements, getModelElementsByClass, removeModelElement, removeModelElementAndChildrenFromResource
 
Methods inherited from class org.eclipse.emf.ecore.impl.EObjectImpl
eAdapters, eClass, eContainerFeatureID, eDeliver, eInternalContainer, eInvoke, eIsProxy, eSetClass, eSetDeliver, eSetProxyURI
 
Methods inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl
eAllContents, eBaseStructuralFeatureID, eBasicRemoveFromContainer, eBasicRemoveFromContainerFeature, eBasicSetContainer, eContainer, eContainingFeature, eContainmentFeature, eContains, eContents, eCrossReferences, eDerivedOperationID, eDerivedOperationID, eDerivedStructuralFeatureID, eDerivedStructuralFeatureID, eDirectResource, eDynamicBasicRemoveFromContainer, eDynamicGet, eDynamicGet, eDynamicInverseAdd, eDynamicInverseRemove, eDynamicInvoke, eDynamicIsSet, eDynamicIsSet, eDynamicSet, eDynamicSet, eDynamicUnset, eDynamicUnset, eGet, eGet, eGet, eGet, eInternalResource, eInverseAdd, eInverseAdd, eInverseRemove, eInverseRemove, eInvoke, eIsSet, eIsSet, eObjectForURIFragmentSegment, eOpenGet, eOpenIsSet, eOpenSet, eOpenUnset, eProxyURI, eResolveProxy, eResource, eSet, eSet, eSetResource, eSetStore, eSetting, eStore, eUnset, eUnset, eURIFragmentSegment, eVirtualGet, eVirtualGet, eVirtualIsSet, eVirtualSet, eVirtualUnset, toString
 
Methods inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
eNotificationRequired, eNotify
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.emfstore.internal.common.model.IdEObjectCollection
addModelElement, allocateModelElementIds, clearAllocatedCaches, contains, contains, deleteModelElement, disallocateModelElementIds, getAllModelElements, getEObjectToIdMapping, getIdToEObjectMapping, getModelElement, getModelElementId, getModelElements, getModelElementsByClass
 
Methods inherited from interface org.eclipse.emf.ecore.EObject
eAllContents, eClass, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eGet, eInvoke, eIsProxy, eIsSet, eResource, eSet, eUnset
 
Methods inherited from interface org.eclipse.emf.common.notify.Notifier
eAdapters, eDeliver, eNotify, eSetDeliver
 
Methods inherited from interface org.eclipse.emf.emfstore.common.model.ESObjectContainer
getAllModelElementsByClass, getAllModelElementsByClass
 
Methods inherited from interface org.eclipse.emf.emfstore.common.model.ESIdToEObjectMapping
get
 
Methods inherited from interface org.eclipse.emf.emfstore.internal.common.api.APIDelegate
createAPI, toAPI
 
Methods inherited from interface org.eclipse.emf.ecore.InternalEObject
eNotificationRequired
 

Constructor Detail

NotifiableIdEObjectCollectionImpl

public NotifiableIdEObjectCollectionImpl(org.eclipse.emf.ecore.xmi.XMIResource xmiResource)
                                  throws IOException
Constructor. Adds the contents of the given XMIResource as model elements to the collection. If the XMIResource also has XMI IDs assigned to the EObjects it contains, they will be used for creating the model element IDs within the project, if not, the model element IDs will get created on the fly. An EObjectChangeNotifier is also attached to the given XMIResource.

Parameters:
xmiResource - a XMIResource
Throws:
IOException - if the given XMIResource could not be loaded
Method Detail

modelElementAdded

public void modelElementAdded(IdEObjectCollection collection,
                              org.eclipse.emf.ecore.EObject eObject)
Called when the eObject has been added to the collection.

Specified by:
modelElementAdded in interface IdEObjectCollectionChangeObserver
Parameters:
collection - the IdEObjectCollection to which the eObject was added
eObject - the EObject that has been added to the collection
See Also:
IdEObjectCollectionChangeObserver.modelElementAdded(org.eclipse.emf.emfstore.internal.common.model.IdEObjectCollection, org.eclipse.emf.ecore.EObject)

addCutElement

public abstract void addCutElement(org.eclipse.emf.ecore.EObject eObject)
Add a new cut element.

Parameters:
eObject - The new cut element.

initMapping

public void initMapping()
Description copied from class: IdEObjectCollectionImpl
Initializes the ID caches of the collection, i.e. the collection will call IdEObjectCollection.getModelElements() and for each model element the ModelElementId is fetched via IdEObjectCollection.getModelElementId(EObject). Then a mapping between the model element and its ModelElementId is created within the cache.

Specified by:
initMapping in interface IdEObjectCollection
Overrides:
initMapping in class IdEObjectCollectionImpl
See Also:
IdEObjectCollection.initMapping()

initMapping

public void initMapping(Map<org.eclipse.emf.ecore.EObject,String> eObjectToIdMap,
                        Map<String,org.eclipse.emf.ecore.EObject> idToEObjectMap)
/** Initializes the ID caches of the project with the given mappings.

Specified by:
initMapping in interface IdEObjectCollection
Overrides:
initMapping in class IdEObjectCollectionImpl
Parameters:
eObjectToIdMap - a mapping from EObjects to IDs
idToEObjectMap - the reverse mapping of eObjectToIdMap
See Also:
IdEObjectCollectionImpl.initMapping(java.util.Map, java.util.Map)

notify

public void notify(org.eclipse.emf.common.notify.Notification notification,
                   IdEObjectCollection project,
                   org.eclipse.emf.ecore.EObject modelElement)
A notification on a model element of the collection occurred. See Notification documentation for details on the notifications. This method will be called even if the given notification results from an add or remove of a model element of the project.

Specified by:
notify in interface IdEObjectCollectionChangeObserver
Parameters:
notification - the notification
project - the collection holding the modelElement
modelElement - the model element the notification originates from
See Also:
IdEObjectCollectionChangeObserver.notify(org.eclipse.emf.common.notify.Notification, org.eclipse.emf.emfstore.internal.common.model.IdEObjectCollection, org.eclipse.emf.ecore.EObject)

addIdEObjectCollectionChangeObserver

public void addIdEObjectCollectionChangeObserver(IdEObjectCollectionChangeObserver eObjectChangeObserver)
Adds an IdEObjectCollectionChangeObserver to the collection.

Specified by:
addIdEObjectCollectionChangeObserver in interface NotifiableIdEObjectCollection
Parameters:
eObjectChangeObserver - a change observer to be added
See Also:
NotifiableIdEObjectCollection.addIdEObjectCollectionChangeObserver(org.eclipse.emf.emfstore.internal.common.model.util.IdEObjectCollectionChangeObserver)

removeIdEObjectCollectionChangeObserver

public void removeIdEObjectCollectionChangeObserver(IdEObjectCollectionChangeObserver projectChangeObserver)
Remove an IdEObjectCollectionChangeObserver from the collection.

Specified by:
removeIdEObjectCollectionChangeObserver in interface NotifiableIdEObjectCollection
Parameters:
projectChangeObserver - a change observer to be removed
See Also:
NotifiableIdEObjectCollection.removeIdEObjectCollectionChangeObserver(org.eclipse.emf.emfstore.internal.common.model.util.IdEObjectCollectionChangeObserver)

setUndetachable

public void setUndetachable(IdEObjectCollectionChangeObserver observer)
Make a project change observer undetachable.

Parameters:
observer - the observer

modelElementRemoved

public void modelElementRemoved(IdEObjectCollection projectImpl,
                                org.eclipse.emf.ecore.EObject modelElement)
Called when the eObject and its siblings have been removed from the collection. NOTE: Note that you will NOT receive a separate notification for each sibling.

Specified by:
modelElementRemoved in interface IdEObjectCollectionChangeObserver
Parameters:
projectImpl - the IdEObjectCollection to which the eObject was added
modelElement - the EObject that has been added to the collection
See Also:
IdEObjectCollectionChangeObserver.modelElementRemoved(org.eclipse.emf.emfstore.internal.common.model.IdEObjectCollection, org.eclipse.emf.ecore.EObject)

copy

public <T extends IdEObjectCollection> T copy()
Copies the current collection.

Overrides:
copy in class IdEObjectCollectionImpl
Type Parameters:
T - the actual collection type to be copied
Returns:
the copied collection

collectionDeleted

public void collectionDeleted(IdEObjectCollection collection)
If the IdEObjectCollection is deleted.

Specified by:
collectionDeleted in interface IdEObjectCollectionChangeObserver
Parameters:
collection - the IdEObjectCollection that has been deleted
See Also:
IdEObjectCollectionChangeObserver.collectionDeleted(org.eclipse.emf.emfstore.internal.common.model.IdEObjectCollection)

getChangeNotifier

public EObjectChangeNotifier getChangeNotifier()
Returns the change notifier attached to this collection.

Specified by:
getChangeNotifier in interface NotifiableIdEObjectCollection
Returns:
an EObjectChangeNotifier
See Also:
NotifiableIdEObjectCollection.getChangeNotifier()


Copyright © 2015. All Rights Reserved.