FileDocCategorySizeDatePackage
ClassnameFilter.javaAPI DocJ2ME CLDC 1.12536Wed Feb 05 15:56:04 GMT 2003util

ClassnameFilter

public class ClassnameFilter extends Object implements FilenameFilter

Fields Summary
boolean
includeAll
boolean
conditional
Hashtable
includedClass
Hashtable
includedPackage
Constructors Summary
public ClassnameFilter(boolean conditional)

  // string package names

        
    this.conditional = conditional;
    
public ClassnameFilter()

    this(false);
    
Methods Summary
public booleanaccept(java.io.File dir, java.lang.String className)

    if ( includedClass.get( className ) != null ){
        return true;
    } else if (includeAll) {
        return true;
    } else {
        String pkgName = className;
        int pkgLength = className.lastIndexOf('/");
        // look at immediate package, and superpackage, and ...
        while ( pkgLength > 0 ){
        pkgName = pkgName.substring( 0, pkgLength );
        if ( includedPackage.get( pkgName ) != null ){
            return true; 
        }
        pkgLength = pkgName.lastIndexOf('/");
        }
    }
    return false;
    
public voidincludeClass(java.lang.String className)

    includedClass.put( className, className );
    
public voidincludeName(java.lang.String classname)

    if ( classname.charAt( classname.length()-1 ) == '*" ){
        // this is a package name, not a class name
        // strip off trailing junk and put it on the included package
        // list.
        int pkgLength = classname.lastIndexOf( '/" );
        if ( pkgLength < 0 )
        includePackage( null );
        else
        includePackage( classname.substring(  0, pkgLength ) );
    } else {
        includeClass( classname );
    }
    
public voidincludePackage(java.lang.String packageName)

    if ( packageName == null || (packageName.length() == 0 ) )
        includeAll = true;
    else
        includedPackage.put( packageName, packageName );