edu.rice.cs.dynamicjava.interpreter
Class LocalContext

java.lang.Object
  extended by edu.rice.cs.dynamicjava.interpreter.DelegatingContext
      extended by edu.rice.cs.dynamicjava.interpreter.LocalContext
All Implemented Interfaces:
TypeContext

public class LocalContext
extends DelegatingContext

The context following a local class, variable, or function definition.


Constructor Summary
LocalContext(TypeContext next, ClassLoader loader, DJClass c)
           
LocalContext(TypeContext next, ClassLoader loader, Iterable<DJClass> classes, Iterable<LocalVariable> vars, Iterable<LocalFunction> functions)
           
LocalContext(TypeContext next, Iterable<LocalVariable> vars)
           
LocalContext(TypeContext next, LocalFunction f)
           
LocalContext(TypeContext next, LocalVariable var)
           
 
Method Summary
protected  LocalContext duplicate(TypeContext next)
          Create a copy of this context with the given context enclosing it.
 boolean fieldExists(String name, TypeSystem ts)
          Test whether name is an in-scope field
 boolean functionExists(String name, TypeSystem ts)
          Test whether name is an in-scope method or local function
 ClassLoader getClassLoader()
          Return the class loader for the current scope.
 Iterable<LocalFunction> getLocalFunctions(String name, TypeSystem ts, Iterable<LocalFunction> partial)
          Helper for getLocalFunctions: list all matching functions, including those provided.
 LocalVariable getLocalVariable(String name, TypeSystem ts)
          Return the variable object for the given name, or null if it does not exist.
 DJClass getTopLevelClass(String name, TypeSystem ts)
          Return the top-level class with the given name, or null if it does not exist.
 VariableType getTypeVariable(String name, TypeSystem ts)
          Return the type variable with the given name, or null if it does not exist.
 boolean localFunctionExists(String name, TypeSystem ts)
          Test whether name is an in-scope local function
 boolean localVariableExists(String name, TypeSystem ts)
          Test whether name is an in-scope local variable
 boolean memberClassExists(String name, TypeSystem ts)
          Test whether name is an in-scope member class
 boolean methodExists(String name, TypeSystem ts)
          Test whether name is an in-scope method
 boolean topLevelClassExists(String name, TypeSystem ts)
          Test whether name is an in-scope top-level class
 ClassType typeContainingField(String name, TypeSystem ts)
          Return the most inner type containing a field with the given name, or null if there is no such type.
 ClassType typeContainingMemberClass(String name, TypeSystem ts)
          Return the most inner type containing a class with the given name, or null if there is no such type.
 Type typeContainingMethod(String name, TypeSystem ts)
          Return the most inner type containing a method with the given name, or null if there is no such type.
 boolean typeExists(String name, TypeSystem ts)
          Test whether name is an in-scope top-level class, member class, or type variable
 boolean typeVariableExists(String name, TypeSystem ts)
          Test whether name is an in-scope type variable.
 boolean variableExists(String name, TypeSystem ts)
          Test whether name is an in-scope field or local variable
 
Methods inherited from class edu.rice.cs.dynamicjava.interpreter.DelegatingContext
accessModule, getDeclaredThrownTypes, getLocalFunctions, getReturnType, getThis, getThis, getThis, importField, importMemberClass, importMemberClasses, importMethod, importStaticMembers, importTopLevelClass, importTopLevelClasses, initializingClass, makeAnonymousClassName, makeClassName, setPackage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalContext

public LocalContext(TypeContext next,
                    ClassLoader loader,
                    Iterable<DJClass> classes,
                    Iterable<LocalVariable> vars,
                    Iterable<LocalFunction> functions)

LocalContext

public LocalContext(TypeContext next,
                    Iterable<LocalVariable> vars)

LocalContext

public LocalContext(TypeContext next,
                    LocalVariable var)

LocalContext

public LocalContext(TypeContext next,
                    ClassLoader loader,
                    DJClass c)

LocalContext

public LocalContext(TypeContext next,
                    LocalFunction f)
Method Detail

duplicate

protected LocalContext duplicate(TypeContext next)
Description copied from class: DelegatingContext
Create a copy of this context with the given context enclosing it.

Specified by:
duplicate in class DelegatingContext

typeExists

public boolean typeExists(String name,
                          TypeSystem ts)
Description copied from class: DelegatingContext
Test whether name is an in-scope top-level class, member class, or type variable

Specified by:
typeExists in interface TypeContext
Overrides:
typeExists in class DelegatingContext

topLevelClassExists

public boolean topLevelClassExists(String name,
                                   TypeSystem ts)
Description copied from class: DelegatingContext
Test whether name is an in-scope top-level class

Specified by:
topLevelClassExists in interface TypeContext
Overrides:
topLevelClassExists in class DelegatingContext

getTopLevelClass

public DJClass getTopLevelClass(String name,
                                TypeSystem ts)
                         throws AmbiguousNameException
Description copied from class: DelegatingContext
Return the top-level class with the given name, or null if it does not exist.

Specified by:
getTopLevelClass in interface TypeContext
Overrides:
getTopLevelClass in class DelegatingContext
Throws:
AmbiguousNameException

memberClassExists

public boolean memberClassExists(String name,
                                 TypeSystem ts)
Description copied from class: DelegatingContext
Test whether name is an in-scope member class

Specified by:
memberClassExists in interface TypeContext
Overrides:
memberClassExists in class DelegatingContext

typeContainingMemberClass

public ClassType typeContainingMemberClass(String name,
                                           TypeSystem ts)
                                    throws AmbiguousNameException
Description copied from class: DelegatingContext
Return the most inner type containing a class with the given name, or null if there is no such type.

Specified by:
typeContainingMemberClass in interface TypeContext
Overrides:
typeContainingMemberClass in class DelegatingContext
Throws:
AmbiguousNameException

typeVariableExists

public boolean typeVariableExists(String name,
                                  TypeSystem ts)
Description copied from class: DelegatingContext
Test whether name is an in-scope type variable.

Specified by:
typeVariableExists in interface TypeContext
Overrides:
typeVariableExists in class DelegatingContext

getTypeVariable

public VariableType getTypeVariable(String name,
                                    TypeSystem ts)
Description copied from class: DelegatingContext
Return the type variable with the given name, or null if it does not exist.

Specified by:
getTypeVariable in interface TypeContext
Overrides:
getTypeVariable in class DelegatingContext

variableExists

public boolean variableExists(String name,
                              TypeSystem ts)
Description copied from class: DelegatingContext
Test whether name is an in-scope field or local variable

Specified by:
variableExists in interface TypeContext
Overrides:
variableExists in class DelegatingContext

localVariableExists

public boolean localVariableExists(String name,
                                   TypeSystem ts)
Description copied from class: DelegatingContext
Test whether name is an in-scope local variable

Specified by:
localVariableExists in interface TypeContext
Overrides:
localVariableExists in class DelegatingContext

getLocalVariable

public LocalVariable getLocalVariable(String name,
                                      TypeSystem ts)
Description copied from class: DelegatingContext
Return the variable object for the given name, or null if it does not exist.

Specified by:
getLocalVariable in interface TypeContext
Overrides:
getLocalVariable in class DelegatingContext

fieldExists

public boolean fieldExists(String name,
                           TypeSystem ts)
Description copied from class: DelegatingContext
Test whether name is an in-scope field

Specified by:
fieldExists in interface TypeContext
Overrides:
fieldExists in class DelegatingContext

typeContainingField

public ClassType typeContainingField(String name,
                                     TypeSystem ts)
                              throws AmbiguousNameException
Description copied from class: DelegatingContext
Return the most inner type containing a field with the given name, or null if there is no such type.

Specified by:
typeContainingField in interface TypeContext
Overrides:
typeContainingField in class DelegatingContext
Throws:
AmbiguousNameException

functionExists

public boolean functionExists(String name,
                              TypeSystem ts)
Description copied from class: DelegatingContext
Test whether name is an in-scope method or local function

Specified by:
functionExists in interface TypeContext
Overrides:
functionExists in class DelegatingContext

localFunctionExists

public boolean localFunctionExists(String name,
                                   TypeSystem ts)
Description copied from class: DelegatingContext
Test whether name is an in-scope local function

Specified by:
localFunctionExists in interface TypeContext
Overrides:
localFunctionExists in class DelegatingContext

getLocalFunctions

public Iterable<LocalFunction> getLocalFunctions(String name,
                                                 TypeSystem ts,
                                                 Iterable<LocalFunction> partial)
Description copied from interface: TypeContext
Helper for getLocalFunctions: list all matching functions, including those provided.

Specified by:
getLocalFunctions in interface TypeContext
Overrides:
getLocalFunctions in class DelegatingContext

methodExists

public boolean methodExists(String name,
                            TypeSystem ts)
Description copied from class: DelegatingContext
Test whether name is an in-scope method

Specified by:
methodExists in interface TypeContext
Overrides:
methodExists in class DelegatingContext

typeContainingMethod

public Type typeContainingMethod(String name,
                                 TypeSystem ts)
Description copied from class: DelegatingContext
Return the most inner type containing a method with the given name, or null if there is no such type.

Specified by:
typeContainingMethod in interface TypeContext
Overrides:
typeContainingMethod in class DelegatingContext

getClassLoader

public ClassLoader getClassLoader()
Description copied from interface: TypeContext
Return the class loader for the current scope. Allows class loaders to be defined in later scopes with the returned loader as a parent.

Specified by:
getClassLoader in interface TypeContext
Overrides:
getClassLoader in class DelegatingContext