org.eclipse.ocl.examples.pivot.utilities
Class PivotEnvironmentFactory

java.lang.Object
  extended by org.eclipse.ocl.examples.pivot.AbstractEnvironmentFactory
      extended by org.eclipse.ocl.examples.pivot.utilities.PivotEnvironmentFactory
All Implemented Interfaces:
Adaptable, EnvironmentFactory

public class PivotEnvironmentFactory
extends AbstractEnvironmentFactory

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

Author:
Christian W. Damus (cdamus)

Field Summary
protected  TypeManager typeManager
           
 
Constructor Summary
PivotEnvironmentFactory()
          Initializes me.
PivotEnvironmentFactory(org.eclipse.emf.ecore.EPackage.Registry reg, TypeManager typeManager)
          Initializes me with an EPackage.Registry that the environments I create will use to look up packages.
 
Method Summary
 PivotEnvironment createEnvironment()
          Creates a root environment, in which package contexts and/or classifier contexts will be created as nested environments.
 PivotEnvironment createEnvironment(Environment parent)
          Creates a child environment of a specified parent, for definition of nested scopes.
 PivotEvaluationEnvironment createEvaluationEnvironment()
          Creates a new evaluation environment to track the values of variables in an OCL expression as it is evaluated.
 PivotEvaluationEnvironment createEvaluationEnvironment(EvaluationEnvironment parent)
          Creates a new evaluation environment as a nested environment of the specified parent.
protected  Type getClassifier(java.lang.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.
 org.eclipse.emf.ecore.EPackage.Registry getEPackageRegistry()
          Obtains the package registry used by environment that I create to look up packages.
static PivotEnvironmentFactory getGlobalRegistryInstance()
           
 TypeManager getTypeManager()
           
 PivotEnvironment loadEnvironment(org.eclipse.emf.ecore.resource.Resource resource)
          Loads an environment from the specified resource.
 
Methods inherited from class org.eclipse.ocl.examples.pivot.AbstractEnvironmentFactory
createAttributeContext, createClassifierContext, createEvaluationVisitor, createInstanceContext, createOperationContext, createPackageContext, getAdapter, isEvaluationTracingEnabled, setEvaluationTracingEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

typeManager

protected final TypeManager typeManager
Constructor Detail

PivotEnvironmentFactory

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


PivotEnvironmentFactory

public PivotEnvironmentFactory(org.eclipse.emf.ecore.EPackage.Registry reg,
                               TypeManager typeManager)
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)
typeManager -
Method Detail

getGlobalRegistryInstance

public static PivotEnvironmentFactory getGlobalRegistryInstance()

createEnvironment

public PivotEnvironment 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 PivotEnvironment loadEnvironment(org.eclipse.emf.ecore.resource.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 org.eclipse.emf.ecore.EPackage.Registry getEPackageRegistry()
Obtains the package registry used by environment that I create to look up packages.

Returns:
my package registry

createEnvironment

public PivotEnvironment createEnvironment(Environment 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 PivotEvaluationEnvironment 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 PivotEvaluationEnvironment createEvaluationEnvironment(EvaluationEnvironment 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

getTypeManager

public TypeManager getTypeManager()

getClassifier

protected Type getClassifier(java.lang.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
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