|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavafe.reader.Reader
javafe.reader.CachedReader
CachedReader takes a uncached Reader and produces a cached version of it using a simple implementation of caching via a HashTable.
Reads from GenericFiles with null canonicalIDs are not cached.
Field Summary | |
protected java.util.Hashtable |
cache
Our cache; maps the non-null canonicalID (if it has one) of a GenericFile (see GenericFile.getCanonicalID) to either a CompilationUnit or a CachedReader_Null. |
protected Reader |
underlyingReader
The underlying Reader whose results we are caching. |
Constructor Summary | |
CachedReader(Reader reader)
Creating a cached version of a Reader: |
Method Summary | |
void |
flushAll()
Flush all cached information for this Reader. |
void |
flushTarget(GenericFile target)
Flush the saved info (if any) for target for this Reader. |
protected java.lang.Object |
get(GenericFile target)
Lookup a non-null GenericFile in the cache. |
boolean |
isCached(GenericFile target)
Is the result of read on target cached for this Reader? |
protected void |
put(GenericFile target,
CompilationUnit value)
Store information about a non-null GenericFile in the cache; this has no effect if the GenericFile has a null canonicalID. |
CompilationUnit |
read(GenericFile target,
boolean avoidSpec)
Attempt to read and parse a CompilationUnit from target. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Reader underlyingReader
protected java.util.Hashtable cache
Constructor Detail |
public CachedReader(Reader reader)
Method Detail |
protected final java.lang.Object get(GenericFile target)
protected final void put(GenericFile target, CompilationUnit value)
public boolean isCached(GenericFile target)
Target must be non-null.
public void flushTarget(GenericFile target)
public void flushAll()
public CompilationUnit read(GenericFile target, boolean avoidSpec)
By default, we attempt to read only a spec (e.g., specOnly is set in the resulting CompilationUnit) to save time. If avoidSpec is true, we attempt to return a non-spec, although this may not always be possible.
The results of this function (including null results, but not the action of reporting error messages) are cached. Only the value of avoidSpec used the first time a given file is read is used. This may result in a spec being returned unnecessarily when avoidSpec is true.
Target must be non-null.
read
in class Reader
target
- The source to be readavoidSpec
- If true, then bodies are parsed as well, if possible;
if false, no method bodies are parsed.
|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |