org.eclipse.ocl.ecore.opposites
Class EcoreEnvironmentFactoryWithHiddenOpposites

java.lang.Object
  extended by org.eclipse.ocl.AbstractEnvironmentFactory<org.eclipse.emf.ecore.EPackage,org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature,org.eclipse.emf.ecore.EEnumLiteral,org.eclipse.emf.ecore.EParameter,org.eclipse.emf.ecore.EObject,CallOperationAction,SendSignalAction,Constraint,org.eclipse.emf.ecore.EClass,org.eclipse.emf.ecore.EObject>
      extended by org.eclipse.ocl.ecore.EcoreEnvironmentFactory
          extended by org.eclipse.ocl.ecore.opposites.EcoreEnvironmentFactoryWithHiddenOpposites
All Implemented Interfaces:
EnvironmentFactory<org.eclipse.emf.ecore.EPackage,org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature,org.eclipse.emf.ecore.EEnumLiteral,org.eclipse.emf.ecore.EParameter,org.eclipse.emf.ecore.EObject,CallOperationAction,SendSignalAction,Constraint,org.eclipse.emf.ecore.EClass,org.eclipse.emf.ecore.EObject>, Adaptable
Direct Known Subclasses:
EcoreEnvironmentFactoryWithScopedExtentMap

public class EcoreEnvironmentFactoryWithHiddenOpposites
extends EcoreEnvironmentFactory

An environment factory which can be used to provide a non-null OppositeEndFinder to the OCL environment. This enables lookup and evaluation of so-called "hidden opposites" which are represented by annotations with key "Property#oppositeRoleName" on the forward reference and which allow for querying the opposite direction by simple dotted syntax and by cleanly providing a scope for the opposite lookup.

If no OppositeEndFinder is provided to a constructor, a DefaultOppositeEndFinder is used that is either specific to the registry provided or that is aligned with the default package registry.

Since:
3.1
Author:
Axel Uhl (auhl)

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.ocl.EnvironmentFactory
EnvironmentFactory.Lookup<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
 
Field Summary
static EcoreEnvironmentFactoryWithHiddenOpposites INSTANCE
          A default instance that works with the default package registry.
 
Constructor Summary
EcoreEnvironmentFactoryWithHiddenOpposites()
          Initializes me.
EcoreEnvironmentFactoryWithHiddenOpposites(org.eclipse.emf.ecore.EPackage.Registry reg)
          Initializes me with an EPackage.Registry that the environments I create will use to look up packages.
EcoreEnvironmentFactoryWithHiddenOpposites(org.eclipse.emf.ecore.EPackage.Registry reg, OppositeEndFinder oppositeEndFinder)
          Configures both, a specific package registry as well as a dedicated opposite end finder to be used by the OCL environment created by this factory.
 
Method Summary
protected  OppositeEndFinder createOppositeEndFinder(org.eclipse.emf.ecore.EPackage.Registry registry)
          Returns a null opposite end finder.
 
Methods inherited from class org.eclipse.ocl.ecore.EcoreEnvironmentFactory
createEnvironment, createEnvironment, createEvaluationEnvironment, createEvaluationEnvironment, createEvaluationVisitor, createOCLAnalyzer, createOCLAnalyzer, createOCLFactoryWithHistory, createOCLSyntaxHelper, createValidationVisitor, getClassifier, getEPackageRegistry, getOppositeEndFinder, loadEnvironment, lookupPackage
 
Methods inherited from class org.eclipse.ocl.AbstractEnvironmentFactory
createAttributeContext, createClassifierContext, createInstanceContext, createOperationContext, createPackageContext, createPackageContext, getAdapter, isEvaluationTracingEnabled, setEvaluationTracingEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final EcoreEnvironmentFactoryWithHiddenOpposites INSTANCE
A default instance that works with the default package registry.

Constructor Detail

EcoreEnvironmentFactoryWithHiddenOpposites

public EcoreEnvironmentFactoryWithHiddenOpposites()
Initializes me. Environments that I create will use the global package registry to look up packages. Uses the result of DefaultOppositeEndFinder.getInstance() as opposite end finder.


EcoreEnvironmentFactoryWithHiddenOpposites

public EcoreEnvironmentFactoryWithHiddenOpposites(org.eclipse.emf.ecore.EPackage.Registry reg)
Initializes me with an EPackage.Registry that the environments I create will use to look up packages. A new DefaultOppositeEndFinder object is created for the specific package registry provided as reg.

Parameters:
reg - my package registry (must not be null)

EcoreEnvironmentFactoryWithHiddenOpposites

public EcoreEnvironmentFactoryWithHiddenOpposites(org.eclipse.emf.ecore.EPackage.Registry reg,
                                                  OppositeEndFinder oppositeEndFinder)
Configures both, a specific package registry as well as a dedicated opposite end finder to be used by the OCL environment created by this factory.

Method Detail

createOppositeEndFinder

protected OppositeEndFinder createOppositeEndFinder(org.eclipse.emf.ecore.EPackage.Registry registry)
Description copied from class: EcoreEnvironmentFactory
Returns a null opposite end finder. This means that by default no hidden opposites will be found and no CPU cycles will be used even for looking them up.

Subclasses can redefine this accordingly. See, e.g., EcoreEnvironmentFactoryWithHiddenOpposites.

Overrides:
createOppositeEndFinder in class EcoreEnvironmentFactory