polyglot.types
Class CachingResolver

java.lang.Object
  extended by polyglot.types.CachingResolver
All Implemented Interfaces:
java.lang.Cloneable, Resolver, Copy
Direct Known Subclasses:
SystemResolver

public class CachingResolver
extends java.lang.Object
implements Resolver, Copy

A CachingResolver memoizes another Resolver


Field Summary
protected  Resolver inner
           
 
Constructor Summary
CachingResolver(Resolver inner)
           
CachingResolver(Resolver inner, boolean cacheNotFound)
          Create a caching resolver.
 
Method Summary
 void addNamed(java.lang.String name, Named q)
          Install a qualifier in the cache.
protected  java.util.Collection cachedObjects()
           
 Named check(java.lang.String name)
          Check if a type object is in the cache, returning null if not.
 java.lang.Object copy()
           
 void dump()
           
 Named find(java.lang.String name)
          Find a type object by name.
 Resolver inner()
          The resolver whose results this resolver caches.
 void install(java.lang.String name, Named q)
          Install a qualifier in the cache.
protected  boolean shouldReport(int level)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

inner

protected Resolver inner
Constructor Detail

CachingResolver

public CachingResolver(Resolver inner,
                       boolean cacheNotFound)
Create a caching resolver.

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

CachingResolver

public CachingResolver(Resolver inner)
Method Detail

shouldReport

protected boolean shouldReport(int level)

copy

public java.lang.Object copy()
Specified by:
copy in interface Copy

inner

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


toString

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

cachedObjects

protected java.util.Collection cachedObjects()

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

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

dump

public void dump()