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

escjava.reader
Class RefinementCachedReader

java.lang.Object
  extended byjavafe.reader.Reader
      extended byjavafe.reader.CachedReader
          extended byescjava.reader.RefinementCachedReader

public class RefinementCachedReader
extends CachedReader

RefinementCachedReader caches compilation units that have been read, as does its super class. However, before doing so, it retrieves all files of a refinement sequence, combines them and caches the combined result against all of the file names. Thus if any file in the refinement sequence is read again, the refinement combination will be produced.

Reads from GenericFiles with null canonicalIDs are not cached.


Field Summary
protected  AnnotationHandler annotationHandler
          The underlying Reader whose results we are caching.
protected  java.util.ArrayList refinementSequence
           
 
Fields inherited from class javafe.reader.CachedReader
cache, underlyingReader
 
Constructor Summary
RefinementCachedReader(Reader reader)
          Creating a cached version of a Reader:
 
Method Summary
static GenericFile findRefined(java.lang.String[] pkgStrings, CompilationUnit cu)
           
(package private)  CompilationUnit getCombinedBinaries(Name pkgName, java.lang.String[] pkg, java.util.ArrayList rs)
           
(package private)  java.util.ArrayList getRefinementSequence(java.lang.String[] pkgStrings, Identifier type, CompilationUnit cu, boolean avoidSpec)
           
 CompilationUnit isAlreadyRead(GenericFile target)
          * Caching methods: * *
 CompilationUnit read(GenericFile target, boolean avoidSpec)
          Attempt to read and parse a CompilationUnit from target.
 CompilationUnit readRefinements(CompilationUnit cu, boolean avoidSpec)
           
 
Methods inherited from class javafe.reader.CachedReader
flushAll, flushTarget, get, isCached, put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

annotationHandler

protected AnnotationHandler annotationHandler
The underlying Reader whose results we are caching.


refinementSequence

protected java.util.ArrayList refinementSequence
Constructor Detail

RefinementCachedReader

public RefinementCachedReader(Reader reader)
Creating a cached version of a Reader:

Method Detail

isAlreadyRead

public CompilationUnit isAlreadyRead(GenericFile target)
* Caching methods: * *


read

public CompilationUnit read(GenericFile target,
                            boolean avoidSpec)
Attempt to read and parse a CompilationUnit from target. Any errors encountered are reported via javafe.util.ErrorSet. Null is returned iff an error was encountered.

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.

Overrides:
read in class CachedReader

readRefinements

public CompilationUnit readRefinements(CompilationUnit cu,
                                       boolean avoidSpec)

getCombinedBinaries

CompilationUnit getCombinedBinaries(Name pkgName,
                                    java.lang.String[] pkg,
                                    java.util.ArrayList rs)

getRefinementSequence

java.util.ArrayList getRefinementSequence(java.lang.String[] pkgStrings,
                                          Identifier type,
                                          CompilationUnit cu,
                                          boolean avoidSpec)

findRefined

public static GenericFile findRefined(java.lang.String[] pkgStrings,
                                      CompilationUnit cu)

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

The ESC/Java2 Project Homepage