uk.ac.ucl.cs.emofocl.ocl.parser
Class Environment

java.lang.Object
  extended by uk.ac.ucl.cs.emofocl.ocl.parser.Environment

public class Environment
extends Object

Author:
jwskene

Constructor Summary
Environment(Environment parent, MOFClass context)
           
Environment(MOFClass context)
           
Environment(Operation context)
           
 
Method Summary
 void addVariableReference(String name, boolean mayBeImplicit, VariableDeclaration referredElement)
           
 Type getBooleanType()
           
 CollectionType getCollectionType(CollectionKind kind, Type elementType)
           
 Reference getImplicitVariable()
           
 Type getIntegerType()
           
 InvalidType getInvalidType()
           
 LibraryOperationCallExp getLibraryOperationCallExp(Type sourceType, String name, List arguments)
          Constructs a library operation call expression, if any known library operations match the parameters provided.
 EMOFOCLPackage getModel()
           
 Environment getNestedEnvironment()
           
 Type getOCLTypeFromMultiplicityElement(MultiplicityElement element)
           
 Type getRealType()
           
 Type getStringType()
           
 TupleType getTupleType(List elementNames, List elementTypes)
           
 VoidType getVoidType()
           
 boolean isCollectionType(Type type)
           
 Property lookupImplicitAttribute(String name)
          May return null.
 Type lookupType(List path)
           
 Type lookupType(String name)
           
 Reference lookupVariable(String name)
          May return null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Environment

public Environment(MOFClass context)

Environment

public Environment(Operation context)

Environment

public Environment(Environment parent,
                   MOFClass context)
Method Detail

getNestedEnvironment

public Environment getNestedEnvironment()

getModel

public EMOFOCLPackage getModel()

lookupVariable

public Reference lookupVariable(String name)
May return null. Never complains as failure to find a variable may mean that the name is referring to an implicit attribute or a type instead.

Parameters:
name -
Returns:

lookupType

public Type lookupType(String name)
                throws EnvironmentException
Throws:
EnvironmentException

lookupType

public Type lookupType(List path)
                throws EnvironmentException
Throws:
EnvironmentException

addVariableReference

public void addVariableReference(String name,
                                 boolean mayBeImplicit,
                                 VariableDeclaration referredElement)
                          throws EnvironmentException
Throws:
EnvironmentException

lookupImplicitAttribute

public Property lookupImplicitAttribute(String name)
May return null. Never complains, because failure to find an implicit attribute may mean that the name is referring to a type instead.


getImplicitVariable

public Reference getImplicitVariable()

getOCLTypeFromMultiplicityElement

public Type getOCLTypeFromMultiplicityElement(MultiplicityElement element)

getCollectionType

public CollectionType getCollectionType(CollectionKind kind,
                                        Type elementType)

getVoidType

public VoidType getVoidType()

getInvalidType

public InvalidType getInvalidType()

isCollectionType

public boolean isCollectionType(Type type)

getTupleType

public TupleType getTupleType(List elementNames,
                              List elementTypes)

getBooleanType

public Type getBooleanType()

getIntegerType

public Type getIntegerType()

getRealType

public Type getRealType()

getStringType

public Type getStringType()

getLibraryOperationCallExp

public LibraryOperationCallExp getLibraryOperationCallExp(Type sourceType,
                                                          String name,
                                                          List arguments)
                                                   throws EnvironmentException
Constructs a library operation call expression, if any known library operations match the parameters provided. Neither the name of the call nor the arguments are set on return, so remember to do this.

Parameters:
sourceType -
name -
arguments -
Returns:
Throws:
EnvironmentException