org.eclipse.ocl.ecore
Class EcoreEnvironmentFactory

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

public class EcoreEnvironmentFactory
extends AbstractEnvironmentFactory<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject>

Implementation of the EnvironmentFactory for parsing OCL expressions on Ecore models.


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 EcoreEnvironmentFactory INSTANCE
          A convenient shared instance of the environment factory, that creates environments using the global package registry.
 
Constructor Summary
EcoreEnvironmentFactory()
          Initializes me.
EcoreEnvironmentFactory(EPackage.Registry reg)
          Initializes me with an EPackage.Registry that the environments I create will use to look up packages.
 
Method Summary
 Environment<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> createEnvironment()
          Creates a root environment, in which package contexts and/or classifier contexts will be created as nested environments.
 Environment<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> createEnvironment(Environment<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> parent)
          Creates a child environment of a specified parent, for definition of nested scopes.
 EvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject> createEvaluationEnvironment()
          Creates a new evaluation environment to track the values of variables in an OCL expression as it is evaluated.
 EvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject> createEvaluationEnvironment(EvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject> parent)
          Creates a new evaluation environment as a nested environment of the specified parent.
protected  EClassifier getClassifier(Object context)
          Obtains client metamodel's classifier for the specified context object, which may be an instance of a classifier in the user model or may actually be a classifier in the user model.
 EPackage.Registry getEPackageRegistry()
          Obtains the package registry used by environment that I create to look up packages.
 Environment<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> loadEnvironment(Resource resource)
          Loads an environment from the specified resource.
protected  EPackage lookupPackage(List<String> pathname)
          Looks up the package identified by the specified qualified name by whatever means is appropriate to the particular environment implementation.
 
Methods inherited from class org.eclipse.ocl.AbstractEnvironmentFactory
createAttributeContext, createClassifierContext, createEvaluationVisitor, 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 EcoreEnvironmentFactory INSTANCE
A convenient shared instance of the environment factory, that creates environments using the global package registry.

Constructor Detail

EcoreEnvironmentFactory

public EcoreEnvironmentFactory()
Initializes me. Environments that I create will use the global package registry to look up packages.


EcoreEnvironmentFactory

public EcoreEnvironmentFactory(EPackage.Registry reg)
Initializes me with an EPackage.Registry that the environments I create will use to look up packages.

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

createEnvironment

public Environment<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> createEnvironment()
Description copied from interface: EnvironmentFactory
Creates a root environment, in which package contexts and/or classifier contexts will be created as nested environments. All operation body constraints, attribute initial/derived value constraints, and definitions of additional attributes and operations should be maintained by the root environment, so that they will be accessible from constraints parsed in any nested environment.

Returns:
a new root environment

loadEnvironment

public Environment<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> loadEnvironment(Resource resource)
Description copied from interface: EnvironmentFactory
Loads an environment from the specified resource. If not already loaded, this method will load the resource. This resource will subsequently be used to persist new OCL constraints, so supplying a new, empty resource will allow the client to determine where the environment is persisted.

Parameters:
resource - a resource containing the persisted environment

getEPackageRegistry

public final EPackage.Registry getEPackageRegistry()
Obtains the package registry used by environment that I create to look up packages.

Returns:
my package registry

lookupPackage

protected EPackage lookupPackage(List<String> pathname)
Description copied from class: AbstractEnvironmentFactory
Looks up the package identified by the specified qualified name by whatever means is appropriate to the particular environment implementation.

Specified by:
lookupPackage in class AbstractEnvironmentFactory<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject>
Parameters:
pathname - the qualified name of the package to find
Returns:
the matching package, or null if none is found

getClassifier

protected EClassifier getClassifier(Object context)
Description copied from class: AbstractEnvironmentFactory
Obtains client metamodel's classifier for the specified context object, which may be an instance of a classifier in the user model or may actually be a classifier in the user model.

Specified by:
getClassifier in class AbstractEnvironmentFactory<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject>
Parameters:
context - a context object or classifier
Returns:
the user model's classifier for this context object, or the context itself if it is a classifier

createEnvironment

public Environment<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> createEnvironment(Environment<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> parent)
Description copied from interface: EnvironmentFactory
Creates a child environment of a specified parent, for definition of nested scopes.

Parameters:
parent - the parent environment
Returns:
the child environment

createEvaluationEnvironment

public EvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject> createEvaluationEnvironment()
Description copied from interface: EnvironmentFactory
Creates a new evaluation environment to track the values of variables in an OCL expression as it is evaluated.

Returns:
a new evaluation environment

createEvaluationEnvironment

public EvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject> createEvaluationEnvironment(EvaluationEnvironment<EClassifier,EOperation,EStructuralFeature,EClass,EObject> parent)
Description copied from interface: EnvironmentFactory
Creates a new evaluation environment as a nested environment of the specified parent.

Parameters:
parent - a nesting evaluation environment
Returns:
a new nested evaluation environment

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.