edu.rice.cs.dynamicjava.interpreter
Class LibraryContext

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

public class LibraryContext
extends DelegatingContext

A context that can access top-level classes from a Library.


Constructor Summary
LibraryContext(Library lib)
          Create a LibraryContext that delegates to the BaseContext.
LibraryContext(TypeContext next, Library lib)
          Create a LibraryContext that delegates to the given context (typically another LibraryContext).
 
Method Summary
protected  TypeContext duplicate(TypeContext next)
          Create a copy of this context with the given context enclosing it.
 java.lang.ClassLoader getClassLoader()
          Return the class loader for the current scope.
 DJClass getTopLevelClass(java.lang.String name, TypeSystem ts)
          Return the top-level class with the given name, or null if it does not exist.
 VariableType getTypeVariable(java.lang.String name, TypeSystem ts)
          Return the type variable with the given name, or null if it does not exist.
 boolean memberClassExists(java.lang.String name, TypeSystem ts)
          Test whether name is an in-scope member class
 boolean topLevelClassExists(java.lang.String name, TypeSystem ts)
          Test whether name is an in-scope top-level class
 ClassType typeContainingMemberClass(java.lang.String name, TypeSystem ts)
          Return the most inner type containing a class with the given name, or null if there is no such type.
 boolean typeExists(java.lang.String name, TypeSystem ts)
          Test whether name is an in-scope top-level class, member class, or type variable
 boolean typeVariableExists(java.lang.String name, TypeSystem ts)
          Test whether name is an in-scope type variable.
 
Methods inherited from class edu.rice.cs.dynamicjava.interpreter.DelegatingContext
accessModule, fieldExists, functionExists, getDeclaredThrownTypes, getLocalFunctions, getLocalFunctions, getLocalVariable, getReturnType, getThis, getThis, getThis, importField, importMemberClass, importMemberClasses, importMethod, importStaticMembers, importTopLevelClass, importTopLevelClasses, initializingClass, localFunctionExists, localVariableExists, makeAnonymousClassName, makeClassName, methodExists, setPackage, typeContainingField, typeContainingMethod, variableExists
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LibraryContext

public LibraryContext(TypeContext next,
                      Library lib)
Create a LibraryContext that delegates to the given context (typically another LibraryContext).


LibraryContext

public LibraryContext(Library lib)
Create a LibraryContext that delegates to the BaseContext.

Method Detail

duplicate

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

getClassLoader

public java.lang.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