org.eclipse.ocl.examples.xtext.base.utilities
Class CSI2PivotMapping

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.AdapterImpl
      extended by org.eclipse.ocl.examples.xtext.base.utilities.CSI2PivotMapping
All Implemented Interfaces:
org.eclipse.emf.common.notify.Adapter, org.eclipse.emf.common.notify.Adapter.Internal, MetaModelManagerListener

public class CSI2PivotMapping
extends org.eclipse.emf.common.notify.impl.AdapterImpl
implements MetaModelManagerListener

The CSI2PivotMapping maintains the mapping between CS elements or rather their CSIs that remain stable after recreation and the Pivot elements. This mapping may be used repeatedly while editing (CS2Pivot conversions) to associate changing CS elements with stable Pivot elements. The mapping is also created during a Pivot2CS conversion to allow subsequent CS2Pivot conversions to reuse the original Pivot elements.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
org.eclipse.emf.common.notify.Adapter.Internal
 
Field Summary
protected  java.util.Map<BaseCSResource,ASResource> cs2asResourceMap
          Mapping of each CS resource to its corresponding pivot Resource.
 
Fields inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
target
 
Method Summary
 void add(java.util.Map<? extends BaseCSResource,? extends ASResource> cs2asResourceMap)
           
 void clear()
           
 java.util.Set<java.lang.String> computeCSIs(java.util.Collection<? extends org.eclipse.emf.ecore.resource.Resource> csResources)
           
protected  java.util.Map<Element,ModelElementCS> computePivot2CSMap()
           
 Element get(ModelElementCS csElement)
          Return the Pivot element corresponding to a given CS element.
static CSI2PivotMapping getAdapter(MetaModelManager metaModelManager)
           
 ASResource getASResource(BaseCSResource csResource)
          Return the AS Resource corresponding to a given CS Resource.
 ModelElementCS getCSElement(Element pivotElement)
           
 java.util.Set<BaseCSResource> getCSResources()
          Return all mapped CS Resources.
 java.util.Map<java.lang.String,Element> getMapping()
           
 boolean isAdapterForType(java.lang.Object type)
           
 void metaModelManagerDisposed(MetaModelManager metaModelManager)
          Respond to disposal of the MetaModelManager by eliminating all further usage.
 void put(ModelElementCS csElement, Element pivotElement)
          Install the Pivot element corresponding to a given CS element.
 void removeCSResources(java.util.Set<? extends BaseCSResource> csResources)
          Remove the Resource mappings for all csResources.
 void update()
          Update the mapping to cache the Pivot elements with respect to the CSIs for all CS elements in csResources.
 
Methods inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
getTarget, notifyChanged, setTarget, unsetTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cs2asResourceMap

@NonNull
protected final java.util.Map<BaseCSResource,ASResource> cs2asResourceMap
Mapping of each CS resource to its corresponding pivot Resource.

Method Detail

getAdapter

@NonNull
public static CSI2PivotMapping getAdapter(@NonNull
                                                  MetaModelManager metaModelManager)

add

public void add(java.util.Map<? extends BaseCSResource,? extends ASResource> cs2asResourceMap)

clear

public void clear()

computeCSIs

public java.util.Set<java.lang.String> computeCSIs(java.util.Collection<? extends org.eclipse.emf.ecore.resource.Resource> csResources)

computePivot2CSMap

@NonNull
protected java.util.Map<Element,ModelElementCS> computePivot2CSMap()

get

@Nullable
public Element get(@NonNull
                            ModelElementCS csElement)
Return the Pivot element corresponding to a given CS element.


getASResource

@Nullable
public ASResource getASResource(@Nullable
                                         BaseCSResource csResource)
Return the AS Resource corresponding to a given CS Resource.


getCSResources

@NonNull
public java.util.Set<BaseCSResource> getCSResources()
Return all mapped CS Resources.


getCSElement

@Nullable
public ModelElementCS getCSElement(@NonNull
                                            Element pivotElement)

getMapping

public java.util.Map<java.lang.String,Element> getMapping()

isAdapterForType

public boolean isAdapterForType(java.lang.Object type)
Specified by:
isAdapterForType in interface org.eclipse.emf.common.notify.Adapter
Overrides:
isAdapterForType in class org.eclipse.emf.common.notify.impl.AdapterImpl

metaModelManagerDisposed

public void metaModelManagerDisposed(@NonNull
                                     MetaModelManager metaModelManager)
Description copied from interface: MetaModelManagerListener
Respond to disposal of the MetaModelManager by eliminating all further usage.

Specified by:
metaModelManagerDisposed in interface MetaModelManagerListener

put

public void put(@NonNull
                ModelElementCS csElement,
                @Nullable
                Element pivotElement)
Install the Pivot element corresponding to a given CS element.


removeCSResources

public void removeCSResources(@NonNull
                              java.util.Set<? extends BaseCSResource> csResources)
Remove the Resource mappings for all csResources. The CSI mappings persist until update() is called.


update

public void update()
Update the mapping to cache the Pivot elements with respect to the CSIs for all CS elements in csResources.