koala.dynamicjava.interpreter
Class TreeClassFinder

java.lang.Object
  extended bykoala.dynamicjava.interpreter.TreeClassFinder
All Implemented Interfaces:
ClassFinder

public class TreeClassFinder
extends java.lang.Object
implements ClassFinder

The instances of the classes that implements this interface are used to find the fully qualified name of classes and to manage the loading of these classes.


Field Summary
protected  ClassPool classPool
          The class pool
protected  Context context
          The context
protected  Interpreter interpreter
          The current interpreter
 
Constructor Summary
TreeClassFinder(Context ctx, Interpreter i, ClassPool cp)
          Creates a new class finder
 
Method Summary
 ClassInfo addClassInfo(java.lang.String cname, TypeDeclaration decl)
          Adds a type declaration in the class info list
 java.lang.String getCurrentPackage()
          Returns the current package
 ImportationManager getImportationManager()
          Returns the importation manager
 Interpreter getInterpreter()
          Returns the current interpreter
 ClassInfo lookupClass(java.lang.String cname)
          Loads the class info that match the given name in the source file
 ClassInfo lookupClass(java.lang.String cname, ClassInfo cinfo)
          Loads the class info that match the given name in the source file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected Context context
The context


interpreter

protected Interpreter interpreter
The current interpreter


classPool

protected ClassPool classPool
The class pool

Constructor Detail

TreeClassFinder

public TreeClassFinder(Context ctx,
                       Interpreter i,
                       ClassPool cp)
Creates a new class finder

Parameters:
ctx - the context
i - the current interpreter
cp - the class pool
Method Detail

getInterpreter

public Interpreter getInterpreter()
Returns the current interpreter


getCurrentPackage

public java.lang.String getCurrentPackage()
Returns the current package

Specified by:
getCurrentPackage in interface ClassFinder

getImportationManager

public ImportationManager getImportationManager()
Returns the importation manager


lookupClass

public ClassInfo lookupClass(java.lang.String cname)
                      throws java.lang.ClassNotFoundException
Loads the class info that match the given name in the source file

Specified by:
lookupClass in interface ClassFinder
Parameters:
cname - the name of the class to find
Returns:
the class info
Throws:
java.lang.ClassNotFoundException - if the class cannot be loaded

lookupClass

public ClassInfo lookupClass(java.lang.String cname,
                             ClassInfo cinfo)
                      throws java.lang.ClassNotFoundException
Loads the class info that match the given name in the source file

Specified by:
lookupClass in interface ClassFinder
Parameters:
cname - the name of the class to find
cinfo - the context where 'cname' was found
Returns:
the class info
Throws:
java.lang.ClassNotFoundException - if the class cannot be loaded

addClassInfo

public ClassInfo addClassInfo(java.lang.String cname,
                              TypeDeclaration decl)
Adds a type declaration in the class info list

Specified by:
addClassInfo in interface ClassFinder
Parameters:
cname - the name of the class
decl - the type declaration


Copyright © 2001 Stephane Hillion. All Rights Reserved.