org.eclipse.ocl
Class AbstractEnvironment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>

java.lang.Object
  extended by org.eclipse.ocl.lpg.AbstractBasicEnvironment
      extended by org.eclipse.ocl.AbstractEnvironment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
All Implemented Interfaces:
Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>, Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>, Environment.Lookup<PK,C,O,P>, BasicEnvironment, BasicEnvironment2, Customizable, Adaptable
Direct Known Subclasses:
EcoreEnvironment, UMLEnvironment

public abstract class AbstractEnvironment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
extends AbstractBasicEnvironment
implements Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>, Environment.Lookup<PK,C,O,P>

A partial implementation of the Environment interface providing some useful common behavior for providers of metamodel bindings. It is recommended to extend this class rather than to implement the Environment interface from scratch.

In particular, this class provides:

along with some subclass hook methods and convenience methods.

See the Environment class for a description of the generic type parameters of this class.


Nested Class Summary
protected  class AbstractEnvironment.VariableEntry
          Wrapper for OCL variable declarations that additionally tracks whether they are explicit or implicit variables.
 
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
 
Fields inherited from interface org.eclipse.ocl.Environment
OCL_NAMESPACE_URI, RESULT_VARIABLE_NAME, SELF_VARIABLE_NAME
 
Constructor Summary
protected AbstractEnvironment()
          Initializes me without a parent environment.
protected AbstractEnvironment(AbstractEnvironment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> parent)
          Initializes me with the specified parent environment, which should be of the same type as me.
protected AbstractEnvironment(Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> parent)
          Initializes me with the specified parent environment.
 
Method Summary
protected  void addedVariable(java.lang.String name, Variable<C,PM> variable, boolean isExplicit)
          Persists the specified variable in my resource.
 boolean addElement(java.lang.String name, Variable<C,PM> elem, boolean isExplicit)
          Adds a variable declaration to the environment.
 void addHelperOperation(C owner, O operation)
          Adds an OCL-defined additional ("helper") operation to the environment.
 void addHelperProperty(C owner, P property)
          Adds an OCL-defined additional ("helper") attribute to the environment.
protected  void addOperation(C owner, O operation)
          Deprecated. Since 1.2, use the Environment.Internal.addHelperOperation(Object, Object) API, instead
protected  void addProperty(C owner, P property)
          Deprecated. Since 1.2, use the Environment.Internal.addHelperProperty(Object, Object) API, instead
protected  TypeChecker<C,O,P> createTypeChecker()
          Creates my extensible type checker utility when it is first needed.
 void deleteElement(java.lang.String name)
          Removes a variable when it goes out of scope.
 void dispose()
          I dispose my type resolver, if it is an AbstractTypeResolver and I am the root environment (which owns the resolver).
protected  void findNonNavigableAssociationEnds(C classifier, java.lang.String name, java.util.List<P> ends)
          Searches for non-navigable association ends with the specified name at the given classifier's end of an association.
protected  void findUnnamedAssociationEnds(C classifier, java.lang.String name, java.util.List<P> ends)
          Searches for unnamed association ends using the specified name at the given classifier's end of an association.
<T> T
getAdapter(java.lang.Class<T> adapterType)
          Since AbstractTypeResolver implements TypeChecker, AbstractEnvironment will try to adapt TypeChecker, via its TypeResolver.
 java.util.List<P> getAdditionalAttributes(C classifier)
          Obtains the additional attributes defined in this environment in the context of the specified classifier.
 java.util.List<O> getAdditionalOperations(C classifier)
          Obtains the additional operations defined in this environment in the context of the specified classifier.
 CT getBodyCondition(O operation)
          Obtains an operation's body condition constraint.
 C getContextClassifier()
          Obtains the context classifier of this environment.
 O getContextOperation()
          Obtains the context operation of this environment, if it is an operation context.
 PK getContextPackage()
          Obtains my context package, if any.
 P getContextProperty()
          Obtains the context property of this environment, if it is a property context.
 CT getDeriveConstraint(P property)
          Obtains a property's derived-value constraint.
 CT getInitConstraint(P property)
          Obtains a property's with an initial-value constraint, if any.
 Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> getInternalParent()
          Obtains my parent environment after construction.
 AbstractEnvironment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> getParent()
          Deprecated. Since 1.2, use the getInternalParent() method, instead.
protected  Resource getResource()
          Obtains the resource in which my type resolver persists OCL-generated types and additional features.
 Variable<C,PM> getSelfVariable()
          Gets the self variable, looking it up in a parent environment if necessary.
protected  TypeChecker<C,O,P> getTypeChecker()
          Obtains my extensible type checker utility.
 java.util.Collection<Variable<C,PM>> getVariables()
          Returns the Variables registered explicitly in me and any parents that I may have.
protected  java.lang.String initialLower(java.lang.Object element)
          Gets the name of a named element with its initial character in lower case.
 boolean isEmpty()
          Queries whether the environment has any local variables defined in it.
 Variable<C,PM> lookup(java.lang.String name)
          Obtains the Variable bound to a variable name.
 C lookupAssociationClassReference(C owner, java.lang.String name)
          Finds a reference in the specified class to the named association class.
 Variable<C,PM> lookupImplicitSourceForAssociationClass(java.lang.String name)
          Return an implicit variable that references the named association class.
 Variable<C,PM> lookupImplicitSourceForOperation(java.lang.String name, java.util.List<? extends TypedElement<C>> args)
          Return an implicit variable declaration that defines the specified operation signature.
 Variable<C,PM> lookupImplicitSourceForProperty(java.lang.String name)
          Return the most appropriate matching variable to use as the implicit source of a call to the specified property.
 Variable<C,PM> lookupImplicitSourceForSignal(java.lang.String name, java.util.List<? extends TypedElement<C>> args)
          Return an implicit variable declaration that defines the specified signal reception signature.
 Variable<C,PM> lookupImplicitSourceForState(java.util.List<java.lang.String> path)
          Finds the best-matching implicit variable to use as a source for the unqualified oclIsInState() invocation with the specified state qualified name path.
 Variable<C,PM> lookupLocal(java.lang.String name)
          Obtains the Variable bound to a local variable name.
 O lookupOperation(C owner, java.lang.String name, java.util.List<? extends TypedElement<C>> args)
          Find an operation in the specified class.
 P lookupProperty(C owner, java.lang.String name)
          Finds a property defined or inherited by the specified classifier.
 C lookupSignal(C owner, java.lang.String name, java.util.List<? extends TypedElement<C>> args)
          Finds a received signal in the specified classifier.
 S lookupState(C owner, java.util.List<java.lang.String> path)
          Finds the state identified by the specified qualified name path, to resolve an oclIsInState() operation.
 boolean notOK(Option<ProblemHandler.Severity> option)
          Queries whether I have a non-OK setting for the specified problem option.
protected  void removedVariable(java.lang.String name, Variable<C,PM> variable, boolean isExplicit)
          Removes the specified variable from my resource.
 void setBodyCondition(O operation, CT constraint)
          Associates an operation with an body condition constraint.
protected  void setContextOperation(O contextOperation)
          Assigns my context operation.
protected  void setContextPackage(PK contextPackage)
          Assigns my context package.
protected  void setContextProperty(P contextProperty)
          Assigns my context property.
 void setDeriveConstraint(P property, CT constraint)
          Associates a property with an derived-value constraint.
 void setInitConstraint(P property, CT constraint)
          Associates a property with an initial-value constraint.
 void setInternalParent(Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> parent)
          Assigns me a parent environment after construction.
protected  void setParent(AbstractEnvironment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> parent)
          Assigns me a parent environment after construction.
 void setSelfVariable(Variable<C,PM> var)
          Sets the "self" variable that is the implicit source of any property, operation, or association class call.
 C tryLookupAssociationClassReference(C owner, java.lang.String name)
          This default implementation simply delegates to the Environment.lookupAssociationClassReference(Object, String) method.
 C tryLookupClassifier(java.util.List<java.lang.String> names)
          This default implementation simply delegates to the Environment.lookupClassifier(List) method.
 O tryLookupOperation(C owner, java.lang.String name, java.util.List<? extends TypedElement<C>> args)
          This default implementation simply delegates to the Environment.lookupOperation(Object, String, List) method.
 PK tryLookupPackage(java.util.List<java.lang.String> names)
          This default implementation simply delegates to the Environment.lookupPackage(List) method.
 P tryLookupProperty(C owner, java.lang.String name)
          This default implementation simply delegates to the Environment.lookupProperty(Object, String) method.
 C tryLookupSignal(C owner, java.lang.String name, java.util.List<? extends TypedElement<C>> args)
          This default implementation simply delegates to the Environment.lookupSignal(Object, String, List) method.
 
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.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
 
Methods inherited from interface org.eclipse.ocl.Environment
defineAttribute, defineOperation, getDefinition, getFactory, getOCLFactory, getOCLStandardLibrary, getStates, getTypeResolver, getUMLReflection, isInPostcondition, lookupClassifier, lookupPackage, setParent, undefine
 

Constructor Detail

AbstractEnvironment

protected AbstractEnvironment()
Initializes me without a parent environment.


AbstractEnvironment

protected AbstractEnvironment(Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> parent)
Initializes me with the specified parent environment.

Parameters:
parent - an environment (or null)

AbstractEnvironment

protected AbstractEnvironment(AbstractEnvironment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> parent)
Initializes me with the specified parent environment, which should be of the same type as me.

Parameters:
parent - an environment of the same type as me (or null)
Method Detail

getInternalParent

public Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> getInternalParent()
Description copied from interface: Environment.Internal
Obtains my parent environment after construction.

Specified by:
getInternalParent in interface Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Returns:
my parent

getParent

@Deprecated
public AbstractEnvironment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> getParent()
Deprecated. Since 1.2, use the getInternalParent() method, instead.

Description copied from interface: Environment
Obtains my parent environment, if I have one. My parent environment implements a nesting scope of variable names, some of which names may be shadowed by variables in my scope.

Specified by:
getParent in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Overrides:
getParent in class AbstractBasicEnvironment
Returns:
my parent, or null if I am a root environment

setInternalParent

public void setInternalParent(Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> parent)
Assigns me a parent environment after construction. It is not advisable to set the parent to null if I previously had one.

Specified by:
setInternalParent in interface Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
parent - my new parent

setParent

protected void setParent(AbstractEnvironment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> parent)
Assigns me a parent environment after construction. It is not advisable to set the parent to null if I previously had one.

Parameters:
parent - my new parent

getContextPackage

public PK getContextPackage()
Description copied from interface: Environment
Obtains my context package, if any. The constraints in an OCL document need not declare a package context, but it is at least implicit as the nearest package containing the context classifier.

Specified by:
getContextPackage in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Returns:
my context package
See Also:
Environment.getContextClassifier()

setContextPackage

protected void setContextPackage(PK contextPackage)
Assigns my context package.

Parameters:
contextPackage - my new context package

getContextClassifier

public C getContextClassifier()
Description copied from interface: Environment
Obtains the context classifier of this environment. This is the type of the self context variable.

Specified by:
getContextClassifier in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Returns:
the context classifier

getContextOperation

public O getContextOperation()
Description copied from interface: Environment
Obtains the context operation of this environment, if it is an operation context.

Specified by:
getContextOperation in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Returns:
the context operation, or null if this is not an operation environment

setContextOperation

protected void setContextOperation(O contextOperation)
Assigns my context operation. This method does not create the variables for parameters and the return result.

Parameters:
contextOperation - my context operation

getContextProperty

public P getContextProperty()
Description copied from interface: Environment
Obtains the context property of this environment, if it is a property context.

Specified by:
getContextProperty in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Returns:
the context property, or null if this is not a property environment

setContextProperty

protected void setContextProperty(P contextProperty)
Assigns my context property.

Parameters:
contextProperty - my context property

getResource

protected Resource getResource()
Obtains the resource in which my type resolver persists OCL-generated types and additional features.

Returns:
my resource

isEmpty

public boolean isEmpty()
Description copied from interface: Environment
Queries whether the environment has any local variables defined in it.

Specified by:
isEmpty in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Returns:
true if no local variables are defined; false, otherwise

getVariables

public java.util.Collection<Variable<C,PM>> getVariables()
Description copied from interface: Environment
Returns the Variables registered explicitly in me and any parents that I may have. This does not include implicit variables or variables from parent environments that are shadowed by variables in the nested scope.

Specified by:
getVariables in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Returns:
my variable declarations

addElement

public boolean addElement(java.lang.String name,
                          Variable<C,PM> elem,
                          boolean isExplicit)
Description copied from interface: Environment
Adds a variable declaration to the environment. If the name is null, then a new unique temporary name is generated (this is useful for implicit variables).

Specified by:
addElement in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
name - the name of the variable, or null
elem - a variable declaration
isExplicit - whether this is an explicitly declared variable
Returns:
true if the variable was successfully added because it wasn't already declared locally in this environment; false, otherwise

addedVariable

protected void addedVariable(java.lang.String name,
                             Variable<C,PM> variable,
                             boolean isExplicit)
Persists the specified variable in my resource. Subclasses may extend this method to perform other actions following the addition of a variable to the environment.

Parameters:
name - the variable name
variable - the variable added
isExplicit - whether it is an explicit or implicit variable

deleteElement

public void deleteElement(java.lang.String name)
Description copied from interface: Environment
Removes a variable when it goes out of scope.

Specified by:
deleteElement in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
name - the name of the variable to delete

removedVariable

protected void removedVariable(java.lang.String name,
                               Variable<C,PM> variable,
                               boolean isExplicit)
Removes the specified variable from my resource. Subclasses may extend this method to perform other actions following the removal of a variable from the environment.

Parameters:
name - the variable name
variable - the variable removed
isExplicit - whether it was an explicit or implicit variable

setSelfVariable

public void setSelfVariable(Variable<C,PM> var)
Description copied from interface: Environment
Sets the "self" variable that is the implicit source of any property, operation, or association class call.

Specified by:
setSelfVariable in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
var - the "self" variable

getSelfVariable

public Variable<C,PM> getSelfVariable()
Description copied from interface: Environment
Gets the self variable, looking it up in a parent environment if necessary.

Specified by:
getSelfVariable in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Returns:
the self variable, or null if none (which should only be the case in a root environment having only a package context, if even that)

addHelperProperty

public void addHelperProperty(C owner,
                              P property)
Description copied from interface: Environment.Internal
Adds an OCL-defined additional ("helper") attribute to the environment. This is primarily intended for internal use by the OCL environment implementation and should only be used for properties defined via OCL (such as by the Environment.defineAttribute(C, org.eclipse.ocl.expressions.Variable, CT) method).

Specified by:
addHelperProperty in interface Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
owner - the classifier in which context the attribute is defined
property - the additional attribute

addProperty

@Deprecated
protected void addProperty(C owner,
                                      P property)
Deprecated. Since 1.2, use the Environment.Internal.addHelperProperty(Object, Object) API, instead

Allows subclasses to add a newly OCL-defined additional property to the environment. This should be called by the subclass's implementation of the Environment.defineAttribute(C, org.eclipse.ocl.expressions.Variable, CT) method.

Parameters:
owner - the classifier in which context the attribute is defined
property - the additional attribute

getAdditionalAttributes

public java.util.List<P> getAdditionalAttributes(C classifier)
Description copied from interface: Environment
Obtains the additional attributes defined in this environment in the context of the specified classifier.

Specified by:
getAdditionalAttributes in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
classifier - a classifier
Returns:
its additional attributes, or an empty list if none

addHelperOperation

public void addHelperOperation(C owner,
                               O operation)
Description copied from interface: Environment.Internal
Adds an OCL-defined additional ("helper") operation to the environment. This is primarily intended for internal use by the OCL environment implementation and should only be used for properties defined via OCL (such as by the Environment.defineOperation(C, java.lang.String, C, java.util.List>, CT) method).

Specified by:
addHelperOperation in interface Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
owner - the classifier in which context the attribute is defined
operation - the additional operation

addOperation

@Deprecated
protected void addOperation(C owner,
                                       O operation)
Deprecated. Since 1.2, use the Environment.Internal.addHelperOperation(Object, Object) API, instead

Allows subclasses to add a newly OCL-defined additional operation to the environment. This should be called by the subclass's implementation of the Environment.defineOperation(C, java.lang.String, C, java.util.List>, CT) method.

Parameters:
owner - the classifier in which context the attribute is defined
operation - the additional operation

getAdditionalOperations

public java.util.List<O> getAdditionalOperations(C classifier)
Description copied from interface: Environment
Obtains the additional operations defined in this environment in the context of the specified classifier.

Specified by:
getAdditionalOperations in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
classifier - a classifier
Returns:
its additional operations, or an empty list if none

setInitConstraint

public void setInitConstraint(P property,
                              CT constraint)
Description copied from interface: Environment
Associates a property with an initial-value constraint. The constraint is local to this environment.

Specified by:
setInitConstraint in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
property - an attribute
constraint - its initial-value constraint

getInitConstraint

public CT getInitConstraint(P property)
Description copied from interface: Environment
Obtains a property's with an initial-value constraint, if any.

Specified by:
getInitConstraint in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
property - an attribute
Returns:
its initial-value constraint, or null if none

setDeriveConstraint

public void setDeriveConstraint(P property,
                                CT constraint)
Description copied from interface: Environment
Associates a property with an derived-value constraint. The constraint is local to this environment.

Specified by:
setDeriveConstraint in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
property - an attribute
constraint - its derived-value constraint

getDeriveConstraint

public CT getDeriveConstraint(P property)
Description copied from interface: Environment
Obtains a property's derived-value constraint.

Specified by:
getDeriveConstraint in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
property - an attribute
Returns:
its derived-value constraint

setBodyCondition

public void setBodyCondition(O operation,
                             CT constraint)
Description copied from interface: Environment
Associates an operation with an body condition constraint. The constraint is local to this environment.

Specified by:
setBodyCondition in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
operation - an operation
constraint - its body condition constraint

getBodyCondition

public CT getBodyCondition(O operation)
Description copied from interface: Environment
Obtains an operation's body condition constraint.

Specified by:
getBodyCondition in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
operation - an operation
Returns:
its body condition constraint

lookupLocal

public Variable<C,PM> lookupLocal(java.lang.String name)
Description copied from interface: Environment
Obtains the Variable bound to a local variable name. Does not look in parent environment scopes.

Specified by:
lookupLocal in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
name - a variable name to look up
Returns:
the matching variable, or null if not found in this particular environment

lookup

public Variable<C,PM> lookup(java.lang.String name)
Description copied from interface: Environment
Obtains the Variable bound to a variable name. Looks in parent environment scopes (recursively) for variables not found in the local scope.

Specified by:
lookup in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
name - a variable name to look up
Returns:
the matching variable, or null if not found in this particular environment

lookupOperation

public O lookupOperation(C owner,
                         java.lang.String name,
                         java.util.List<? extends TypedElement<C>> args)
Description copied from interface: Environment
Find an operation in the specified class. Used to resolve operation calls.

Specified by:
lookupOperation in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
owner - the owner type of the called operation, or null to find an implicit owner type (in iteration expressions)
name - the name of the called operation
args - the arguments (expressions or variables) to be matched against the parameter signature of the operation
Returns:
the matching operation, or null if not found

lookupProperty

public P lookupProperty(C owner,
                        java.lang.String name)
Description copied from interface: Environment
Finds a property defined or inherited by the specified classifier.

Specified by:
lookupProperty in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
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

lookupAssociationClassReference

public C lookupAssociationClassReference(C owner,
                                         java.lang.String name)
Description copied from interface: Environment
Finds a reference in the specified class to the named association class.

Specified by:
lookupAssociationClassReference in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
owner - the referencing class to search, or null to find an implicit owner type (in iteration expressions)
name - the association class name (with an initial lower case as per the OCL convention)
Returns:
the association class (generically as a classifier), or null if the specified owner is not at the end of an association with this particular name

lookupSignal

public C lookupSignal(C owner,
                      java.lang.String name,
                      java.util.List<? extends TypedElement<C>> args)
Description copied from interface: Environment
Finds a received signal in the specified classifier.

Specified by:
lookupSignal in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
owner - the owner type of the signal reception
name - the name of the signal
args - the arguments (expressions or variables) matching the properties of the signal (parameters of the reception feature)
Returns:
the matching signal, or null if not found

lookupState

public S lookupState(C owner,
                     java.util.List<java.lang.String> path)
              throws LookupException
Description copied from interface: Environment
Finds the state identified by the specified qualified name path, to resolve an oclIsInState() operation.

Specified by:
lookupState in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
owner - the type on which the oclIsInState() operation is invoked
path - the state name to seek
Returns:
the matching state object, or null if not found
Throws:
LookupException - in the case that this path is ambiguous; i.e., that it does not qualify a state reference with the state machine name to select between same-named states in different state machines

lookupImplicitSourceForOperation

public Variable<C,PM> lookupImplicitSourceForOperation(java.lang.String name,
                                                       java.util.List<? extends TypedElement<C>> args)
Description copied from interface: Environment
Return an implicit variable declaration that defines the specified operation signature. Variables are returned based on inner-most scope first.

Specified by:
lookupImplicitSourceForOperation in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
name - the operation name
args - the list of arguments (expressions or variables) to match against the operation parameters
Returns:
the matching variable, or null if no appropriate variable can be found whose type defines a property of this name

lookupImplicitSourceForProperty

public Variable<C,PM> lookupImplicitSourceForProperty(java.lang.String name)
Description copied from interface: Environment
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:
lookupImplicitSourceForProperty in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
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

lookupImplicitSourceForAssociationClass

public Variable<C,PM> lookupImplicitSourceForAssociationClass(java.lang.String name)
Description copied from interface: Environment
Return an implicit variable that references the named association class. Variables are returned based on inner-most scope first.

Specified by:
lookupImplicitSourceForAssociationClass in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
name - the association class name to seek
Returns:
the matching variable, or null if no appropriate variable can be found whose type defines a property of this name

lookupImplicitSourceForSignal

public Variable<C,PM> lookupImplicitSourceForSignal(java.lang.String name,
                                                    java.util.List<? extends TypedElement<C>> args)
Description copied from interface: Environment
Return an implicit variable declaration that defines the specified signal reception signature. Variables are returned based on inner-most scope first.

Specified by:
lookupImplicitSourceForSignal in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
name - the signal name
args - the list of arguments (expressions or variables) to match against the signal reception parameters
Returns:
the matching variable, or null if no appropriate variable can be found whose type defines a property of this name

lookupImplicitSourceForState

public Variable<C,PM> lookupImplicitSourceForState(java.util.List<java.lang.String> path)
                                            throws LookupException
Description copied from interface: Environment
Finds the best-matching implicit variable to use as a source for the unqualified oclIsInState() invocation with the specified state qualified name path.

Specified by:
lookupImplicitSourceForState in interface Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Parameters:
path - the state name to seek
Returns:
the implicit variable having the specified state, or null if not found
Throws:
LookupException - in the case that this path is ambiguous; i.e., that it does not qualify a state reference with the state machine name to select between same-named states in different state machines

initialLower

protected java.lang.String initialLower(java.lang.Object element)
Gets the name of a named element with its initial character in lower case.

Parameters:
element - a named element
Returns:
the element's name, with an initial lower case letter

tryLookupAssociationClassReference

public C tryLookupAssociationClassReference(C owner,
                                            java.lang.String name)
                                     throws LookupException
This default implementation simply delegates to the Environment.lookupAssociationClassReference(Object, String) method.

Specified by:
tryLookupAssociationClassReference in interface Environment.Lookup<PK,C,O,P>
Parameters:
owner - the referencing class to search, or null to find an implicit owner type (in iteration expressions)
name - the association class name (with an initial lower case as per the OCL convention)
Returns:
the association class (generically as a classifier), or null if the specified owner is not at the end of an association with this particular name
Throws:
LookupException - if lookup fails due to an error such as an ambiguity
Since:
1.2

tryLookupClassifier

public C tryLookupClassifier(java.util.List<java.lang.String> names)
                      throws LookupException
This default implementation simply delegates to the Environment.lookupClassifier(List) method.

Specified by:
tryLookupClassifier in interface Environment.Lookup<PK,C,O,P>
Parameters:
names - the qualified name
Returns:
the matching classifier, or null if not found
Throws:
LookupException - if lookup fails due to an error such as an ambiguity
Since:
1.2

tryLookupOperation

public O tryLookupOperation(C owner,
                            java.lang.String name,
                            java.util.List<? extends TypedElement<C>> args)
                     throws LookupException
This default implementation simply delegates to the Environment.lookupOperation(Object, String, List) method.

Specified by:
tryLookupOperation in interface Environment.Lookup<PK,C,O,P>
Parameters:
owner - the owner type of the called operation, or null to find an implicit owner type (in iteration expressions)
name - the name of the called operation
args - the arguments (expressions or variables) to be matched against the parameter signature of the operation
Returns:
the matching operation, or null if not found
Throws:
LookupException - if lookup fails due to an error such as an ambiguity
Since:
1.2

tryLookupSignal

public C tryLookupSignal(C owner,
                         java.lang.String name,
                         java.util.List<? extends TypedElement<C>> args)
                  throws LookupException
This default implementation simply delegates to the Environment.lookupSignal(Object, String, List) method.

Specified by:
tryLookupSignal in interface Environment.Lookup<PK,C,O,P>
Parameters:
owner - the owner type of the signal reception
name - the name of the signal
args - the arguments (expressions or variables) matching the properties of the signal (parameters of the reception feature)
Returns:
the matching signal, or null if not found
Throws:
LookupException - if lookup fails due to an error such as an ambiguity
Since:
1.2

tryLookupPackage

public PK tryLookupPackage(java.util.List<java.lang.String> names)
                    throws LookupException
This default implementation simply delegates to the Environment.lookupPackage(List) method.

Specified by:
tryLookupPackage in interface Environment.Lookup<PK,C,O,P>
Parameters:
names - the qualified name
Returns:
the matching package, or null if not found
Throws:
LookupException - if lookup fails due to an error such as an ambiguity
Since:
1.2

tryLookupProperty

public P tryLookupProperty(C 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<PK,C,O,P>
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:
1.2

findNonNavigableAssociationEnds

protected void findNonNavigableAssociationEnds(C classifier,
                                               java.lang.String name,
                                               java.util.List<P> 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

findUnnamedAssociationEnds

protected void findUnnamedAssociationEnds(C classifier,
                                          java.lang.String name,
                                          java.util.List<P> ends)
Searches for unnamed association ends using the specified name at the given classifier's end of an association. Subclasses should reimplement this method if they support non-navigable association ends. It is expected, in OCL, that the supplied name is the initial-lower-case name of the type of the unnamed end.

Parameters:
classifier - a classifier at an association end
name - the initial-lower classifier name to look for
ends - collects the ends found by the subclass implementation

notOK

public boolean notOK(Option<ProblemHandler.Severity> option)
Queries whether I have a non-OK setting for the specified problem option. In such cases, I will need to be concerned with reporting the problem.

Parameters:
option - the problem option
Returns:
whether I have a setting for it that is not OK
See Also:
ProblemHandler.Severity#OK

dispose

public void dispose()
I dispose my type resolver, if it is an AbstractTypeResolver and I am the root environment (which owns the resolver).

Specified by:
dispose in interface Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
Since:
1.2

getTypeChecker

protected TypeChecker<C,O,P> getTypeChecker()
Obtains my extensible type checker utility. If it has not already been initialized before, then it is lazily createTypeChecker().

Returns:
my type-checker
Since:
1.3
See Also:
createTypeChecker()

createTypeChecker

protected TypeChecker<C,O,P> createTypeChecker()
Creates my extensible type checker utility when it is first needed. A default implementation is supplied, which subclasses may replace by overriding this method.

Returns:
a new type-checker
Since:
1.3
See Also:
getTypeChecker()

getAdapter

public <T> T getAdapter(java.lang.Class<T> adapterType)
Since AbstractTypeResolver implements TypeChecker, AbstractEnvironment will try to adapt TypeChecker, via its TypeResolver.

Specified by:
getAdapter in interface Adaptable
Overrides:
getAdapter in class AbstractBasicEnvironment
Type Parameters:
T - the requested adapter interface
Parameters:
adapterType - the requested adapter interface
Returns:
an instance of the requested interface, or null if this environment does not adapt to it
Since:
1.3
See Also:
AbstractBasicEnvironment.getAdapter(java.lang.Class)

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