polyglot.frontend
Class SourceLoader

java.lang.Object
  extended by polyglot.frontend.SourceLoader

public class SourceLoader
extends java.lang.Object

A SourceLoader is responsible for loading source files.


Field Summary
protected  int caseInsensitive
          0 if unknown, 1 if case insensitive, -1 if not.
protected  java.util.Map directoryContentsCache
          This is a map from Files (of directories) to Set[String]s, which records the first level of contents of the directory.
protected  java.util.Set loadedSources
          Set of sources already loaded.
protected  ExtensionInfo sourceExt
           
protected  java.util.Collection sourcePath
           
 
Constructor Summary
SourceLoader(ExtensionInfo sourceExt, java.util.Collection sourcePath)
           
 
Method Summary
protected  java.lang.String canonicalize(java.lang.String fileName)
           
 boolean caseInsensitive()
          Is the file system case insensitive.
 FileSource classSource(java.lang.String className)
          Load the source file for the given class name using the source path.
protected static java.io.File current_dir()
          The current user directory.
 java.lang.Object fileKey(java.io.File file)
           
 FileSource fileSource(java.lang.String fileName)
          Load a source from a specific file.
 boolean packageExists(java.lang.String name)
          Check if a directory for a package exists.
protected  void setCaseInsensitive(java.lang.String fileName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sourceExt

protected ExtensionInfo sourceExt

sourcePath

protected java.util.Collection sourcePath

caseInsensitive

protected int caseInsensitive
0 if unknown, 1 if case insensitive, -1 if not.


loadedSources

protected java.util.Set loadedSources
Set of sources already loaded. An attempt to load a source already loaded will cause an IOException.


directoryContentsCache

protected java.util.Map directoryContentsCache
This is a map from Files (of directories) to Set[String]s, which records the first level of contents of the directory. This cache is used to avoid a number of File.exists() calls.

Constructor Detail

SourceLoader

public SourceLoader(ExtensionInfo sourceExt,
                    java.util.Collection sourcePath)
Method Detail

fileSource

public FileSource fileSource(java.lang.String fileName)
                      throws java.io.IOException
Load a source from a specific file.

Throws:
java.io.IOException

current_dir

protected static java.io.File current_dir()
The current user directory.


packageExists

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


classSource

public FileSource classSource(java.lang.String className)
Load the source file for the given class name using the source path.


fileKey

public java.lang.Object fileKey(java.io.File file)

caseInsensitive

public boolean caseInsensitive()
Is the file system case insensitive.


setCaseInsensitive

protected void setCaseInsensitive(java.lang.String fileName)

canonicalize

protected java.lang.String canonicalize(java.lang.String fileName)