org.eclipse.ocl.ecore
Class EcoreEnvironment

java.lang.Object
  extended by org.eclipse.ocl.lpg.AbstractBasicEnvironment
      extended by org.eclipse.ocl.AbstractEnvironment<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.EcoreEnvironment
All Implemented Interfaces:
EnvironmentWithHiddenOpposites, Environment<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>, Environment.Internal<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>, Environment.Lookup<org.eclipse.emf.ecore.EPackage,org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature>, BasicEnvironment, BasicEnvironment2, Customizable, Adaptable

public class EcoreEnvironment
extends AbstractEnvironment<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>
implements EnvironmentWithHiddenOpposites

Implementation of the Environment for parsing OCL expressions on Ecore models. The EcoreEnvironment uses a client-supplied package registry (or the global registry) to look up EPackages by qualified name.

Author:
Edith Schonberg (edith), Christian W. Damus (cdamus)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.ocl.AbstractEnvironment
AbstractEnvironment.VariableEntry
 
Nested classes/interfaces inherited from interface org.eclipse.ocl.Environment
Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>, Environment.Lookup<PK,C,O,P>, Environment.Registry
 
Field Summary
static java.lang.String OCL_STANDARD_LIBRARY_NS_URI
          The namespace URI of the Ecore representation of the OCL Standard Library.
 
Fields inherited from interface org.eclipse.ocl.Environment
OCL_NAMESPACE_URI, RESULT_VARIABLE_NAME, SELF_VARIABLE_NAME
 
Constructor Summary
protected EcoreEnvironment(EcoreEnvironmentFactory fac, org.eclipse.emf.ecore.resource.Resource resource)
          Initializes me with an environment factory from which package registry and opposite end finder (if any) are obtained consistently, and from a resource in which I am persisted (and from which I load myself if it already has content).
protected EcoreEnvironment(Environment<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> parent)
          Initializes me with a parent environment, from which I inherit such things as a package registry and a resource.
protected EcoreEnvironment(org.eclipse.emf.ecore.EPackage.Registry reg)
          Deprecated. Use #EcoreEnvironment(EcoreEnvironmentFactory, null) instead
protected EcoreEnvironment(org.eclipse.emf.ecore.EPackage.Registry reg, org.eclipse.emf.ecore.resource.Resource resource)
          Deprecated. Use EcoreEnvironment(EcoreEnvironmentFactory, Resource) instead
 
Method Summary
protected  void collectStates(org.eclipse.emf.ecore.EClassifier owner, java.util.List<java.lang.String> pathPrefix, java.util.List<org.eclipse.emf.ecore.EObject> states)
          Implemented by subclasses to find all states in the specified owner type that match the given path name prefix and add them to the accumulator list.
protected  TypeResolver<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature> createTypeResolver()
          Deprecated. Override the createTypeResolver(Resource) method, instead, handling the case where the resource is null
protected  TypeResolver<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature> createTypeResolver(org.eclipse.emf.ecore.resource.Resource resource)
           Creates a new type resolver for use with this environment.
 org.eclipse.emf.ecore.EStructuralFeature defineAttribute(org.eclipse.emf.ecore.EClassifier owner, Variable<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EParameter> variable, Constraint constraint)
          In processing an additional attribute definition, constructs the property and associates it with its definition constraint.
 org.eclipse.emf.ecore.EOperation defineOperation(org.eclipse.emf.ecore.EClassifier owner, java.lang.String name, org.eclipse.emf.ecore.EClassifier type, java.util.List<Variable<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EParameter>> params, Constraint constraint)
          In processing an additional operation definition, constructs the operation and associates it with its definition constraint.
protected  void findNonNavigableAssociationEnds(org.eclipse.emf.ecore.EClassifier classifier, java.lang.String name, java.util.List<org.eclipse.emf.ecore.EStructuralFeature> ends)
          If a "hidden" opposite is found (because a forward reference has a "Property.oppositeRoleName" annotation specifying a name for the opposite role), this method adds a temporary EReference to the ends list which has no container set and as its opposite uses the forward reference.
protected  void findOppositeEnds(org.eclipse.emf.ecore.EClassifier classifier, java.lang.String name, java.util.List<org.eclipse.emf.ecore.EReference> ends)
          Searches for non-navigable association ends with the specified name at the given classifier's end of an association.
static org.eclipse.emf.ecore.EPackage findPackage(java.util.List<java.lang.String> packageNames)
          Looks in the EMF registry for a package with the specified qualified package name.
static org.eclipse.emf.ecore.EPackage findPackage(java.util.List<java.lang.String> packageNames, org.eclipse.emf.ecore.EPackage.Registry registry)
          Looks in the given registry for a package with the specified qualified package name.
 Constraint getDefinition(java.lang.Object feature)
          Obtains the definition constraint of the specified feature, if it is an additional attribute or operation defined via an OCL constraint.
 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> getFactory()
          Obtains the factory that created me, or an appropriate default factory if I was not created using a factory.
 java.util.Map<java.lang.String,org.eclipse.emf.ecore.EReference> getHiddenOppositeProperties(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.
 OCLFactory getOCLFactory()
          Obtains a factory for the creation of types that are parameterized by model elements.
 OCLStandardLibrary<org.eclipse.emf.ecore.EClassifier> getOCLStandardLibrary()
          Obtains the collection of core types representing the OCL Standard Library.
 OppositeEndFinder getOppositeEndFinder()
           
 org.eclipse.emf.ecore.EClassifier getOppositePropertyType(org.eclipse.emf.ecore.EClassifier owner, org.eclipse.emf.ecore.EReference property)
          Determines a property's (hidden) opposite's type, assuming that there is not real opposite but that the opposite's type implicitly defaults to the property's owning class.
 java.util.List<org.eclipse.emf.ecore.EObject> getStates(org.eclipse.emf.ecore.EClassifier owner, java.util.List<java.lang.String> pathPrefix)
          Obtains the states matching the specified path prefix in the owner type by trying the collectStates(org.eclipse.emf.ecore.EClassifier, java.util.List, java.util.List) method on it and, recursively, its supertypes to find all matches.
 TypeResolver<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature> getTypeResolver()
          Obtains a type resolver to be used to create (and cache) concrete bindings for the generic OCL types, based on the user model types provided by this environment.
 UMLReflection<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> getUMLReflection()
          Obtains a utility for for reflection on the UML metaclasses that are used by the OCL abstract syntax.
 boolean isInPostcondition(OCLExpression<org.eclipse.emf.ecore.EClassifier> exp)
          Checks whether the specified OCL expression is in an operation postcondition constraint.
 org.eclipse.emf.ecore.EClassifier lookupClassifier(java.util.List<java.lang.String> names)
          Finds the classifier identified by the specified sequence of names (a qualified name).
 Variable<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EParameter> lookupImplicitSourceForOppositeProperty(java.lang.String name)
          Return the most appropriate matching variable to use as the implicit source of a call to the specified property.
 org.eclipse.emf.ecore.EReference lookupOppositeProperty(org.eclipse.emf.ecore.EClassifier owner, java.lang.String name)
          Looks up a non-navigable association end on behalf of the specified owner classifier (which is at that end).
 org.eclipse.emf.ecore.EPackage lookupPackage(java.util.List<java.lang.String> path)
          Finds the package identified by the specified sequence of names (a qualified name).
protected  void setFactory(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> factory)
          Deprecated. factory will become final in future releases; use one of the constructors taking an EcoreEnvironmentFactory argument instead
 void setParent(Environment<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> env)
          Sets my parent environment.
 org.eclipse.emf.ecore.EReference tryLookupOppositeProperty(org.eclipse.emf.ecore.EClassifier owner, java.lang.String name)
          This default implementation simply delegates to the Environment#lookupOppositeProperty(Object, String) method.
 org.eclipse.emf.ecore.EStructuralFeature tryLookupProperty(org.eclipse.emf.ecore.EClassifier owner, java.lang.String name)
          This default implementation simply delegates to the Environment.lookupProperty(Object, String) method.
 void undefine(java.lang.Object feature)
          Removes the definition of an additional operation or property.
 
Methods inherited from class org.eclipse.ocl.AbstractEnvironment
addedVariable, addElement, addHelperOperation, addHelperProperty, addOperation, addProperty, createTypeChecker, deleteElement, dispose, findUnnamedAssociationEnds, getAdapter, getAdditionalAttributes, getAdditionalOperations, getBodyCondition, getContextClassifier, getContextOperation, getContextPackage, getContextProperty, getDeriveConstraint, getElement, getElementsSize, getInitConstraint, getInternalParent, getParent, getResource, getSelfVariable, getTypeChecker, getVariables, initialLower, isEmpty, lookup, lookupAssociationClassReference, lookupImplicitSourceForAssociationClass, lookupImplicitSourceForOperation, lookupImplicitSourceForProperty, lookupImplicitSourceForSignal, lookupImplicitSourceForState, lookupLocal, lookupNonNavigableEnd, lookupOperation, lookupProperty, lookupSignal, lookupState, notOK, removedVariable, resetTypeCaches, setBodyCondition, setContextOperation, setContextPackage, setContextProperty, setDeriveConstraint, setInitConstraint, setInternalParent, setParent, setSelfVariable, tryLookupAssociationClassReference, tryLookupClassifier, tryLookupOperation, tryLookupPackage, tryLookupSignal
 
Methods inherited from class org.eclipse.ocl.lpg.AbstractBasicEnvironment
analyzerError, analyzerError, analyzerError, analyzerWarning, basicGetOptions, clearOptions, createDefaultProblemHandler, createFormattingHelper, getASTMapping, getASTNodeToCSTNodeMap, getFormatter, getOptions, getParser, getProblemHandler, getValue, initASTMapping, initASTMapping, isEnabled, lexerError, parserError, problem, putOptions, removeOption, removeOptions, setASTNodeToCSTNodeMap, setOption, setParent, setParser, setProblemHandler, utilityError, validatorError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ocl.Environment
addElement, deleteElement, getAdditionalAttributes, getAdditionalOperations, getBodyCondition, getContextClassifier, getContextOperation, getContextPackage, getContextProperty, getDeriveConstraint, getInitConstraint, getParent, getSelfVariable, getVariables, isEmpty, lookup, lookupAssociationClassReference, lookupImplicitSourceForAssociationClass, lookupImplicitSourceForOperation, lookupImplicitSourceForProperty, lookupImplicitSourceForSignal, lookupImplicitSourceForState, lookupLocal, lookupOperation, lookupProperty, lookupSignal, lookupState, setBodyCondition, setDeriveConstraint, setInitConstraint, setSelfVariable
 
Methods inherited from interface org.eclipse.ocl.lpg.BasicEnvironment
analyzerError, analyzerError, analyzerError, analyzerWarning, getASTMapping, getFormatter, getParser, getProblemHandler, initASTMapping, lexerError, parserError, problem, setParser, setProblemHandler, utilityError, validatorError
 
Methods inherited from interface org.eclipse.ocl.options.Customizable
clearOptions, getOptions, getValue, isEnabled, putOptions, removeOption, removeOptions, setOption
 

Field Detail

OCL_STANDARD_LIBRARY_NS_URI

public static final java.lang.String OCL_STANDARD_LIBRARY_NS_URI
The namespace URI of the Ecore representation of the OCL Standard Library.

Since:
1.3
See Also:
Constant Field Values
Constructor Detail

EcoreEnvironment

@Deprecated
protected EcoreEnvironment(org.eclipse.emf.ecore.EPackage.Registry reg)
Deprecated. Use #EcoreEnvironment(EcoreEnvironmentFactory, null) instead

Initializes me with a package registry for package look-ups.

Parameters:
reg - a package registry

EcoreEnvironment

protected EcoreEnvironment(EcoreEnvironmentFactory fac,
                           org.eclipse.emf.ecore.resource.Resource resource)
Initializes me with an environment factory from which package registry and opposite end finder (if any) are obtained consistently, and from a resource in which I am persisted (and from which I load myself if it already has content).

Parameters:
reg - a package registry
resource - a resource, which may or may not already have content
Since:
3.1

EcoreEnvironment

@Deprecated
protected EcoreEnvironment(org.eclipse.emf.ecore.EPackage.Registry reg,
                                      org.eclipse.emf.ecore.resource.Resource resource)
Deprecated. Use EcoreEnvironment(EcoreEnvironmentFactory, Resource) instead

Initializes me with a package registry and a resource in which I am persisted (and from which I load myself if it already has content).

Parameters:
reg - a package registry
resource - a resource, which may or may not already have content

EcoreEnvironment

protected EcoreEnvironment(Environment<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> parent)
Initializes me with a parent environment, from which I inherit such things as a package registry and a resource.

Parameters:
parent - my parent environment
Method Detail

getFactory

public 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> getFactory()
Description copied from interface: Environment
Obtains the factory that created me, or an appropriate default factory if I was not created using a factory. This factory can be used to create nested environments within me.

Specified by:
getFactory in interface Environment<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>
Returns:
my originating factory
See Also:
EnvironmentFactory.createEnvironment(Environment)

setFactory

@Deprecated
protected void setFactory(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> factory)
Deprecated. factory will become final in future releases; use one of the constructors taking an EcoreEnvironmentFactory argument instead

Sets the factory that created me. This method should only be invoked by that factory. If the factory is an EcoreEnvironmentFactory, its opposite end finder will be used as this environment's opposite end finder.

Parameters:
factory - my originating factory

setParent

public void setParent(Environment<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> env)
Description copied from interface: Environment
Sets my parent environment. The parent environment should not generally be set to null if it was not already null.

Specified by:
setParent in interface Environment<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>
Parameters:
env - my new parent environment

getOCLStandardLibrary

public OCLStandardLibrary<org.eclipse.emf.ecore.EClassifier> getOCLStandardLibrary()
Description copied from interface: Environment
Obtains the collection of core types representing the OCL Standard Library. These are the singleton or generic instances of the OCL-defined classifiers such as OclAny, Collection(T), etc. Implementers of OCL metamodel bindings are encouraged to share a single instance of the standard library amonst all of the Environments constructed by a particular EnvironmentFactory.

Specified by:
getOCLStandardLibrary in interface Environment<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>
Returns:
the OCL Standard Library implementation for this environment

getTypeResolver

public TypeResolver<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature> getTypeResolver()
Description copied from interface: Environment
Obtains a type resolver to be used to create (and cache) concrete bindings for the generic OCL types, based on the user model types provided by this environment. These are the types that are parameterized by particular user model elements: collections of particular classifiers, meta-types for particular classifiers, message types for particular operations or signals, and tuple types.

Specified by:
getTypeResolver in interface Environment<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>
Returns:
the type resolver

getOCLFactory

public OCLFactory getOCLFactory()
Description copied from interface: Environment
Obtains a factory for the creation of types that are parameterized by model elements. This type factory must create types that are instances of the metaclass describing classifiers in the client metamodel.

Specified by:
getOCLFactory in interface Environment<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>
Returns:
the appropriate type factory

getUMLReflection

public UMLReflection<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> getUMLReflection()
Description copied from interface: Environment
Obtains a utility for for reflection on the UML metaclasses that are used by the OCL abstract syntax.

Specified by:
getUMLReflection in interface Environment<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>
Returns:
the appropriate reflection instance

createTypeResolver

@Deprecated
protected TypeResolver<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature> createTypeResolver()
Deprecated. Override the createTypeResolver(Resource) method, instead, handling the case where the resource is null

Creates a new type resolver for use with this environment, persisted in a default resource.

Returns:
a new type resolver

createTypeResolver

protected TypeResolver<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature> createTypeResolver(org.eclipse.emf.ecore.resource.Resource resource)

Creates a new type resolver for use with this environment.

Subclasses may override.

Parameters:
resource - the resource for the type resolver's persistence
Returns:
a new type resolver
Since:
1.2

lookupPackage

public org.eclipse.emf.ecore.EPackage lookupPackage(java.util.List<java.lang.String> path)
Finds the package identified by the specified sequence of names (a qualified name).

Implements the inherited specification by looking up the qualified name in my package registry.

Specified by:
lookupPackage in interface Environment<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>
Parameters:
path - the qualified name
Returns:
the matching package, or null if not found

lookupClassifier

public org.eclipse.emf.ecore.EClassifier lookupClassifier(java.util.List<java.lang.String> names)
Description copied from interface: Environment
Finds the classifier identified by the specified sequence of names (a qualified name).

Specified by:
lookupClassifier in interface Environment<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>
Parameters:
names - the qualified name
Returns:
the matching classifier, or null if not found

getStates

public java.util.List<org.eclipse.emf.ecore.EObject> getStates(org.eclipse.emf.ecore.EClassifier owner,
                                                               java.util.List<java.lang.String> pathPrefix)
Obtains the states matching the specified path prefix in the owner type by trying the collectStates(org.eclipse.emf.ecore.EClassifier, java.util.List, java.util.List) method on it and, recursively, its supertypes to find all matches. For implicit (null) owners, looks up the innermost-scoped variable as the implicit source and tries again on this variable's type.

To extend this implementation, override the collectStates(org.eclipse.emf.ecore.EClassifier, java.util.List, java.util.List) method.

Specified by:
getStates in interface Environment<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>
Parameters:
owner - the classifier for which states are being sought. Can be null in the case of an oclIsInState() call on an implicit target
pathPrefix - partial path name of the states being sought. This can be empty to find the first level of state names
Returns:
the list of all possible states directly contained in the namespace indicated by the path prefix (i.e., only one level of state nesting)

collectStates

protected void collectStates(org.eclipse.emf.ecore.EClassifier owner,
                             java.util.List<java.lang.String> pathPrefix,
                             java.util.List<org.eclipse.emf.ecore.EObject> states)
Implemented by subclasses to find all states in the specified owner type that match the given path name prefix and add them to the accumulator list. The default implementation does nothing, as Ecore does not model states.

Implementors must only provide the states defined directly in the namespace indicated by the path prefix (i.e., only one level).

Parameters:
owner - the owner type
pathPrefix - partial qualified name, specifying the parent of the states to be collection
states - a list of states directly owned by the namespace indicated by path prefix, within the owner type
See Also:
getStates(EClassifier, List)

defineAttribute

public org.eclipse.emf.ecore.EStructuralFeature defineAttribute(org.eclipse.emf.ecore.EClassifier owner,
                                                                Variable<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EParameter> variable,
                                                                Constraint constraint)
Description copied from interface: Environment
In processing an additional attribute definition, constructs the property and associates it with its definition constraint. The operation definition is local to this environment.

Specified by:
defineAttribute in interface Environment<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>
Parameters:
owner - the context classifier of the property definition constraint
variable - the name and type of the property (conveniently encapsulated in a variable)
constraint - the definition constraint
Returns:
the defined property

defineOperation

public org.eclipse.emf.ecore.EOperation defineOperation(org.eclipse.emf.ecore.EClassifier owner,
                                                        java.lang.String name,
                                                        org.eclipse.emf.ecore.EClassifier type,
                                                        java.util.List<Variable<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EParameter>> params,
                                                        Constraint constraint)
Description copied from interface: Environment
In processing an additional operation definition, constructs the operation and associates it with its definition constraint. The operation definition is local to this environment.

Specified by:
defineOperation in interface Environment<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>
Parameters:
owner - the context classifier of the property definition constraint
name - the operation name
params - the names and types of the parameters, if any (conveniently encapsulated in variables)
constraint - the definition constraint
Returns:
the defined operation

undefine

public void undefine(java.lang.Object feature)
Description copied from interface: Environment
Removes the definition of an additional operation or property.

Specified by:
undefine in interface Environment<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>
Parameters:
feature - an additional property or operation

getDefinition

public Constraint getDefinition(java.lang.Object feature)
Description copied from interface: Environment
Obtains the definition constraint of the specified feature, if it is an additional attribute or operation defined via an OCL constraint.

Specified by:
getDefinition in interface Environment<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>
Parameters:
feature - a property or operation
Returns:
the definition constraint that defines it, or null if this feature is not defined by OCL

findPackage

public static org.eclipse.emf.ecore.EPackage findPackage(java.util.List<java.lang.String> packageNames)
Looks in the EMF registry for a package with the specified qualified package name. Uses the global package registry.

Parameters:
packageNames - the qualified package name
Returns:
the matching EPackage, or null if not found

findPackage

public static org.eclipse.emf.ecore.EPackage findPackage(java.util.List<java.lang.String> packageNames,
                                                         org.eclipse.emf.ecore.EPackage.Registry registry)
Looks in the given registry for a package with the specified qualified package name.

Parameters:
packageNames - the qualified package name
registry - the EPackage.Registry to look in
Returns:
the matching EPackage, or null if not found

isInPostcondition

public boolean isInPostcondition(OCLExpression<org.eclipse.emf.ecore.EClassifier> exp)
Description copied from interface: Environment
Checks whether the specified OCL expression is in an operation postcondition constraint. This is used in validating the usage of constructs that are only valid in postconditions (e.g., oclIsNew()).

Specified by:
isInPostcondition in interface Environment<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>
Parameters:
exp - an OCL expression
Returns:
true if it is in a postcondition constraint; false, otherwise (including case of no constraint at all)

lookupImplicitSourceForOppositeProperty

public Variable<org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EParameter> lookupImplicitSourceForOppositeProperty(java.lang.String name)
Description copied from interface: EnvironmentWithHiddenOpposites
Return the most appropriate matching variable to use as the implicit source of a call to the specified property. Variables are returned based on inner-most scope first.

Specified by:
lookupImplicitSourceForOppositeProperty in interface EnvironmentWithHiddenOpposites
Parameters:
name - the property name
Returns:
the matching variable, or null if no appropriate variable can be found whose type defines a property of this name
Since:
3.1

lookupOppositeProperty

public org.eclipse.emf.ecore.EReference lookupOppositeProperty(org.eclipse.emf.ecore.EClassifier owner,
                                                               java.lang.String name)
                                                        throws LookupException
Looks up a non-navigable association end on behalf of the specified owner classifier (which is at that end).

Specified by:
lookupOppositeProperty in interface EnvironmentWithHiddenOpposites
Parameters:
owner - a classifier in the context of which the property is used
name - the end name to look up
Returns:
the non-navigable end, or null if it cannot be found
Throws:
LookupException - in case that multiple non-navigable properties are found that have the same name and the problem option is ERROR or worse
Since:
3.1

tryLookupOppositeProperty

public org.eclipse.emf.ecore.EReference tryLookupOppositeProperty(org.eclipse.emf.ecore.EClassifier owner,
                                                                  java.lang.String name)
                                                           throws LookupException
This default implementation simply delegates to the Environment#lookupOppositeProperty(Object, String) method.

Throws:
LookupException
Since:
3.1

tryLookupProperty

public org.eclipse.emf.ecore.EStructuralFeature tryLookupProperty(org.eclipse.emf.ecore.EClassifier owner,
                                                                  java.lang.String name)
                                                           throws LookupException
This default implementation simply delegates to the Environment.lookupProperty(Object, String) method.

Specified by:
tryLookupProperty in interface Environment.Lookup<org.eclipse.emf.ecore.EPackage,org.eclipse.emf.ecore.EClassifier,org.eclipse.emf.ecore.EOperation,org.eclipse.emf.ecore.EStructuralFeature>
Overrides:
tryLookupProperty in class AbstractEnvironment<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>
Parameters:
owner - the owner of the property that we are looking for, or null to find an implicit owner type (in iteration expressions)
name - the property name
Returns:
the property, or null if it could not be found
Throws:
LookupException - if lookup fails due to an error such as an ambiguity
Since:
3.1

findOppositeEnds

protected void findOppositeEnds(org.eclipse.emf.ecore.EClassifier classifier,
                                java.lang.String name,
                                java.util.List<org.eclipse.emf.ecore.EReference> ends)
Searches for non-navigable association ends with the specified name at the given classifier's end of an association. Subclasses should reimplement this method if they support non-navigable association ends.

Parameters:
classifier - a classifier at an association end
name - the non-navigable end name to look for
ends - collects the ends found by the subclass implementation
Since:
3.1

findNonNavigableAssociationEnds

protected void findNonNavigableAssociationEnds(org.eclipse.emf.ecore.EClassifier classifier,
                                               java.lang.String name,
                                               java.util.List<org.eclipse.emf.ecore.EStructuralFeature> ends)
If a "hidden" opposite is found (because a forward reference has a "Property.oppositeRoleName" annotation specifying a name for the opposite role), this method adds a temporary EReference to the ends list which has no container set and as its opposite uses the forward reference. The name of this temporary reference is set to name which equals the value of the "Property.oppositeRoleName" annotation on the forward reference.

The temporary reference is not a valid reference for at least two reasons: its container is not set and its opposite does not name it as its opposite.

Overrides:
findNonNavigableAssociationEnds in class AbstractEnvironment<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>
Parameters:
classifier - a classifier at an association end
name - the non-navigable end name to look for
ends - collects the ends found by the subclass implementation
Since:
3.1

getOppositePropertyType

public org.eclipse.emf.ecore.EClassifier getOppositePropertyType(org.eclipse.emf.ecore.EClassifier owner,
                                                                 org.eclipse.emf.ecore.EReference property)
Description copied from interface: EnvironmentWithHiddenOpposites
Determines a property's (hidden) opposite's type, assuming that there is not real opposite but that the opposite's type implicitly defaults to the property's owning class.

Specified by:
getOppositePropertyType in interface EnvironmentWithHiddenOpposites
Since:
3.1

getHiddenOppositeProperties

public java.util.Map<java.lang.String,org.eclipse.emf.ecore.EReference> getHiddenOppositeProperties(org.eclipse.emf.ecore.EClassifier classifier)
Description copied from interface: EnvironmentWithHiddenOpposites
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.

Specified by:
getHiddenOppositeProperties in interface EnvironmentWithHiddenOpposites
Returns:
a non-null map of all "hidden references" accessible from classifier together with their corresponding forward references
Since:
3.1

getOppositeEndFinder

public OppositeEndFinder getOppositeEndFinder()
Since:
3.1