jltools.types
Class ImportTable

java.lang.Object
  |
  +--jltools.types.ClassResolver
        |
        +--jltools.types.ImportTable
All Implemented Interfaces:
Resolver

public class ImportTable
extends ClassResolver

An ImportTable is a type of ClassResolver that corresponds to a particular source file.

It has a set of package and class imports, which caches the results of lookups for future reference.


Field Summary
protected  ErrorQueue eq
          Used to report errors for lazily added imports.
protected  java.util.List lazyImports
          List of imports which will be lazily added to the table.
protected  java.util.Map map
          Map from names to classes found.
protected  java.util.List packageImports
          A list of all package imports.
protected  java.lang.String pkgName
          Our package
protected  Resolver resolver
          The underlying resolver.
protected  Source source
          The source file associated with the import table.
protected  TypeSystem ts
           
 
Constructor Summary
ImportTable(TypeSystem ts, Resolver base, Source source, ErrorQueue eq)
           
 
Method Summary
 void addClassImport(java.lang.String className)
           
 void addDefaultImports()
           
 void addPackageImport(java.lang.String pkgName)
           
 Type findType(java.lang.String name)
           
protected  void lazyImport()
           
 void setPackage(java.lang.String pkgName)
           
 java.lang.String toString()
           
 
Methods inherited from class jltools.types.ClassResolver
findQualifier
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ts

protected TypeSystem ts

resolver

protected Resolver resolver
The underlying resolver.

packageImports

protected java.util.List packageImports
A list of all package imports.

map

protected java.util.Map map
Map from names to classes found.

lazyImports

protected java.util.List lazyImports
List of imports which will be lazily added to the table.

eq

protected ErrorQueue eq
Used to report errors for lazily added imports.

source

protected Source source
The source file associated with the import table.

pkgName

protected java.lang.String pkgName
Our package
Constructor Detail

ImportTable

public ImportTable(TypeSystem ts,
                   Resolver base,
                   Source source,
                   ErrorQueue eq)
Method Detail

addDefaultImports

public void addDefaultImports()
                       throws SemanticException

setPackage

public void setPackage(java.lang.String pkgName)

addClassImport

public void addClassImport(java.lang.String className)

addPackageImport

public void addPackageImport(java.lang.String pkgName)

findType

public Type findType(java.lang.String name)
              throws SemanticException
Overrides:
findType in class ClassResolver

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

lazyImport

protected void lazyImport()