polyglot.types
Class CachingResolver

java.lang.Object
  extended bypolyglot.types.CachingResolver
All Implemented Interfaces:
Resolver, TopLevelResolver

public class CachingResolver
extends java.lang.Object
implements TopLevelResolver

An CachingResolver memoizes another Resolver


Constructor Summary
CachingResolver(TopLevelResolver inner, ExtensionInfo extInfo)
          Create a caching resolver.
 
Method Summary
 void addNamed(java.lang.String name, Named q)
          Install a qualifier in the cache.
protected  void cachePackage(Package p)
           
 Named check(java.lang.String name)
          Check if a type object is in the cache, returning null if not.
 Type checkType(java.lang.String name)
          Check if a type is in the cache, returning null if not.
 Named find(java.lang.String name)
          Find a type object by name.
 TopLevelResolver inner()
          The resolver whose results this resolver caches.
 void install(java.lang.String name, Named q)
          Install a qualifier in the cache.
 boolean packageExists(java.lang.String name)
          Check if a package exists.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CachingResolver

public CachingResolver(TopLevelResolver inner,
                       ExtensionInfo extInfo)
Create a caching resolver.

Parameters:
inner - The resolver whose results this resolver caches.
Method Detail

inner

public TopLevelResolver inner()
The resolver whose results this resolver caches.


toString

public java.lang.String toString()

packageExists

public boolean packageExists(java.lang.String name)
Check if a package exists.

Specified by:
packageExists in interface TopLevelResolver

cachePackage

protected void cachePackage(Package p)

find

public Named find(java.lang.String name)
           throws SemanticException
Find a type object by name.

Specified by:
find in interface Resolver
Parameters:
name - The name to search for.
Throws:
SemanticException

checkType

public Type checkType(java.lang.String name)
Check if a type is in the cache, returning null if not.

Parameters:
name - The name to search for.

check

public Named check(java.lang.String name)
Check if a type object is in the cache, returning null if not.

Parameters:
name - The name to search for.

install

public void install(java.lang.String name,
                    Named q)
Install a qualifier in the cache.

Parameters:
name - The name of the qualifier to insert.
q - The qualifier to insert.

addNamed

public void addNamed(java.lang.String name,
                     Named q)
              throws SemanticException
Install a qualifier in the cache.

Parameters:
name - The name of the qualifier to insert.
q - The qualifier to insert.
Throws:
SemanticException