edu.cmu.sphinx.tools.gui.util
Class ClassFinder

java.lang.Object
  extended by edu.cmu.sphinx.tools.gui.util.ClassFinder

public class ClassFinder
extends java.lang.Object

This class is used mainly to facilitate scanning all the folders of sphinx system, and to filter classes that are Configurable (implements 'edu.cmu.sphinx.util.props.Configurable' in one of the ancestors) and are not of Interface type.

This class is used by ModelBuilder, and contains only static methods

Author:
Ariani

Constructor Summary
ClassFinder()
           
 
Method Summary
static void findClasses(java.lang.String startDir, java.lang.String startPackage, java.util.Set classList)
          find a list of java classes inside 'startDir', that meets the ancestor and fields requirement for the model recursively goes down to the bottom level
static java.io.BufferedReader findFile(java.lang.String filename)
          find a File, open it and return the content as BufferedReader
static java.util.List findFolder(java.lang.String startDir)
          find a list of folder names that are directly under 'startDir', not recursive
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassFinder

public ClassFinder()
Method Detail

findFile

public static java.io.BufferedReader findFile(java.lang.String filename)
                                       throws java.lang.ClassNotFoundException,
                                              java.io.FileNotFoundException
find a File, open it and return the content as BufferedReader

Parameters:
filename - name of file to be found
Returns:
BufferedReader with file content
Throws:
java.lang.ClassNotFoundException
java.io.FileNotFoundException

findFolder

public static java.util.List findFolder(java.lang.String startDir)
                                 throws java.lang.ClassNotFoundException,
                                        java.io.FileNotFoundException
find a list of folder names that are directly under 'startDir', not recursive

Parameters:
startDir - String name of directory to start the search from
Returns:
list of folders under 'startDir'
Throws:
java.lang.ClassNotFoundException - the class we're looking for is not found
java.io.FileNotFoundException - the folder does not exist

findClasses

public static void findClasses(java.lang.String startDir,
                               java.lang.String startPackage,
                               java.util.Set classList)
                        throws java.lang.ClassNotFoundException,
                               java.io.FileNotFoundException
find a list of java classes inside 'startDir', that meets the ancestor and fields requirement for the model recursively goes down to the bottom level

Parameters:
startDir - String name directory to list
startPackage - String preceeding package names
classList - Set of .class files e.g. "nextDir.nextclass", that passes the filter, and will be in the model startDir and '.class' extension not included as package name
Throws:
ClassNotFoundException, - FileNotFoundException
java.lang.ClassNotFoundException
java.io.FileNotFoundException