org.eclipse.ocl.ecore.opposites
Interface OppositeEndFinder

All Known Implementing Classes:
DefaultOppositeEndFinder

public interface OppositeEndFinder

Implementations shall be able to find and navigate "hidden references" on a classifier by name. Such references can be declared by the annotation detail EcoreEnvironment#PROPERTY_OPPOSITE_ROLE_NAME_KEY on an EAnnotation with source EMOFExtendedMetaData.EMOF_PACKAGE_NS_URI_2_0 on an EReference, thus declaring the name for the otherwise non-existing opposite.
ATTENTION
Per convention each implementation must offer a public constructor with the registry as parameter to support loading by the OCLDelegateDomain and therefore link between ecore model and finder.

Since:
3.1
Author:
Axel Uhl

Field Summary
static java.lang.String PROPERTY_OPPOSITE_ROLE_NAME_KEY
          The key that identifies opposite role names in an annotation
 
Method Summary
 void findOppositeEnds(org.eclipse.emf.ecore.EClassifier classifier, java.lang.String name, java.util.List<org.eclipse.emf.ecore.EReference> ends)
          Looks for EReferences whose type is classifier or any of classifier's super types and that owns an annotation with source EMOFExtendedMetaData.EMOF_PACKAGE_NS_URI_2_0 containing a detail entry with key EcoreEnvironment#PROPERTY_OPPOSITE_ROLE_NAME_KEY and the value equalling name.
 java.util.Set<org.eclipse.emf.ecore.EObject> getAllInstancesSeeing(org.eclipse.emf.ecore.EClass cls, org.eclipse.emf.common.notify.Notifier context)
          Finds all instances of class cls and all its subclasses that can "see" context.
 java.util.Set<org.eclipse.emf.ecore.EObject> getAllInstancesSeenBy(org.eclipse.emf.ecore.EClass cls, org.eclipse.emf.common.notify.Notifier context)
          Finds all instances of class cls and all its subclasses that are visible from context.
 java.util.Map<java.lang.String,org.eclipse.emf.ecore.EReference> getAllOppositeEnds(org.eclipse.emf.ecore.EClassifier classifier)
          Finds all EReferences whose type is classifier or any of classifier's super types and that own an annotation with source EMOFExtendedMetaData.EMOF_PACKAGE_NS_URI_2_0 containing a detail entry with key EcoreEnvironment#PROPERTY_OPPOSITE_ROLE_NAME_KEY.
 java.util.Collection<org.eclipse.emf.ecore.EObject> navigateOppositePropertyWithBackwardScope(org.eclipse.emf.ecore.EReference property, org.eclipse.emf.ecore.EObject target)
          Reverse-navigates the property starting at target.
 java.util.Collection<org.eclipse.emf.ecore.EObject> navigateOppositePropertyWithForwardScope(org.eclipse.emf.ecore.EReference property, org.eclipse.emf.ecore.EObject target)
          Reverse-navigates the property starting at target.
 

Field Detail

PROPERTY_OPPOSITE_ROLE_NAME_KEY

static final java.lang.String PROPERTY_OPPOSITE_ROLE_NAME_KEY
The key that identifies opposite role names in an annotation

See Also:
Constant Field Values
Method Detail

findOppositeEnds

void findOppositeEnds(org.eclipse.emf.ecore.EClassifier classifier,
                      java.lang.String name,
                      java.util.List<org.eclipse.emf.ecore.EReference> ends)
Looks for EReferences whose type is classifier or any of classifier's super types and that owns an annotation with source EMOFExtendedMetaData.EMOF_PACKAGE_NS_URI_2_0 containing a detail entry with key EcoreEnvironment#PROPERTY_OPPOSITE_ROLE_NAME_KEY and the value equalling name. Such references are added to ends.


getAllOppositeEnds

java.util.Map<java.lang.String,org.eclipse.emf.ecore.EReference> getAllOppositeEnds(org.eclipse.emf.ecore.EClassifier classifier)
Finds all EReferences whose type is classifier or any of classifier's super types and that own an annotation with source EMOFExtendedMetaData.EMOF_PACKAGE_NS_URI_2_0 containing a detail entry with key EcoreEnvironment#PROPERTY_OPPOSITE_ROLE_NAME_KEY. The value of the annotation detail is entered into the resulting map as a key, the EReference on which the annotation was found is entered into the result map as the corresponding value.

Returns:
a non-null map of all "hidden references" accessible from classifier together with their corresponding forward references

navigateOppositePropertyWithForwardScope

java.util.Collection<org.eclipse.emf.ecore.EObject> navigateOppositePropertyWithForwardScope(org.eclipse.emf.ecore.EReference property,
                                                                                             org.eclipse.emf.ecore.EObject target)
Reverse-navigates the property starting at target. As a result, one or more objects may result such that when navigating property from any of those, then target will be among the results. If no such objects are found, it is permissible for an implementation to return null. As scope used for this query one should be used by implementers that contains everything that can be seen from target.


navigateOppositePropertyWithBackwardScope

java.util.Collection<org.eclipse.emf.ecore.EObject> navigateOppositePropertyWithBackwardScope(org.eclipse.emf.ecore.EReference property,
                                                                                              org.eclipse.emf.ecore.EObject target)
Reverse-navigates the property starting at target. As a result, one or more objects may result such that when navigating property from any of those, then target will be among the results. If no such objects are found, it is permissible for an implementation to return null. As scope used for this query one should be used by implementers that contains everything that can see target.


getAllInstancesSeeing

java.util.Set<org.eclipse.emf.ecore.EObject> getAllInstancesSeeing(org.eclipse.emf.ecore.EClass cls,
                                                                   org.eclipse.emf.common.notify.Notifier context)
Finds all instances of class cls and all its subclasses that can "see" context.

Returns:
a non-null set

getAllInstancesSeenBy

java.util.Set<org.eclipse.emf.ecore.EObject> getAllInstancesSeenBy(org.eclipse.emf.ecore.EClass cls,
                                                                   org.eclipse.emf.common.notify.Notifier context)
Finds all instances of class cls and all its subclasses that are visible from context.

Returns:
a non-null set