org.eclipse.ocl.ecore.opposites
Class AllInstancesContentAdapter

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.AdapterImpl
      extended by org.eclipse.emf.ecore.util.EContentAdapter
          extended by org.eclipse.ocl.ecore.opposites.AllInstancesContentAdapter
All Implemented Interfaces:
org.eclipse.emf.common.notify.Adapter, org.eclipse.emf.common.notify.Adapter.Internal

public class AllInstancesContentAdapter
extends org.eclipse.emf.ecore.util.EContentAdapter

A content adapter that maintains a map of all EObjects in the scope observed (typically a ResourceSet), keyed by the EClasses to which the objects conform. This allows for fast lookup, e.g., of an allInstances() expression value in the given scope.

Since:
3.1
Author:
Axel Uhl

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
org.eclipse.emf.common.notify.Adapter.Internal
 
Field Summary
 
Fields inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
target
 
Constructor Summary
AllInstancesContentAdapter()
           
 
Method Summary
 java.util.Set<org.eclipse.emf.ecore.EObject> allInstances(org.eclipse.emf.ecore.EClass c)
           
static AllInstancesContentAdapter getInstanceForRootContextOf(org.eclipse.emf.common.notify.Notifier context)
          Looks up an adapter of type AllInstancesContentAdapter in the adapter list of context's root context.
protected  void setTarget(org.eclipse.emf.ecore.EObject target)
           
protected  void unsetTarget(org.eclipse.emf.ecore.EObject target)
           
 
Methods inherited from class org.eclipse.emf.ecore.util.EContentAdapter
addAdapter, basicSetTarget, basicUnsetTarget, handleContainment, notifyChanged, removeAdapter, resolve, selfAdapt, setTarget, setTarget, setTarget, unsetTarget, unsetTarget, unsetTarget, unsetTarget
 
Methods inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
getTarget, isAdapterForType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AllInstancesContentAdapter

public AllInstancesContentAdapter()
Method Detail

getInstanceForRootContextOf

public static AllInstancesContentAdapter getInstanceForRootContextOf(org.eclipse.emf.common.notify.Notifier context)
Looks up an adapter of type AllInstancesContentAdapter in the adapter list of context's root context. The root context is determined by ascending the EObject containment hierarchy, then to a Resource and perhaps a ResourceSet. The last element reachable in this order is the root context. If on this root context an adapter of type AllInstancesContentAdapter is already registered, it is returned. Otherwise, a new adapter of this class is created and added to the root context's adapter list. This will recursively apply the adapter to all contents, populating the adapter's allInstances map so that afterwards allInstances(EClass) returns results in the scope of context's root context.


setTarget

protected void setTarget(org.eclipse.emf.ecore.EObject target)
Overrides:
setTarget in class org.eclipse.emf.ecore.util.EContentAdapter

unsetTarget

protected void unsetTarget(org.eclipse.emf.ecore.EObject target)
Overrides:
unsetTarget in class org.eclipse.emf.ecore.util.EContentAdapter

allInstances

public java.util.Set<org.eclipse.emf.ecore.EObject> allInstances(org.eclipse.emf.ecore.EClass c)