FileDocCategorySizeDatePackage
ClassnameFilterList.javaAPI DocJ2ME CLDC 1.12339Wed Feb 05 15:56:04 GMT 2003util

ClassnameFilterList

public class ClassnameFilterList extends Object

Fields Summary
private Vector
groups
private Vector
filters
Constructors Summary
public ClassnameFilterList()

    groups = new Vector();
    filters = new Vector();
    
Methods Summary
public voidaddTypePatterns(java.lang.String group, java.lang.String patterns)

    boolean conditional;
    // If a pattern starts with '-', it matches only if there
    // were no earlier matches
    if (patterns.charAt(0) == '-") {
        conditional = true;
        patterns = patterns.substring(1);
    } else {
        conditional = false;
    }
    ClassnameFilter f = new ClassnameFilter(conditional);
    parseClassList( patterns, f );
    groups.addElement(group.intern());
    filters.addElement(f);
    
public java.lang.String[]getTypes(java.lang.String classname)

    Vector types = new Vector(1);
    int l = groups.size();
    for (int i = 0; i < l; ++i) {
        String name = (String)groups.elementAt(i);
        ClassnameFilter f = (ClassnameFilter)filters.elementAt(i);
        // If a pattern is conditional, it matches only if there
        // were no earlier matches
        if (types.size() == 0 || !f.conditional) {
        if (f.accept(null, classname)) {
            types.addElement(name);
        }
        }
    }
    String[] strings = new String[types.size()];
    types.copyInto(strings);
    return strings;
    
public booleanisType(java.lang.String classname, java.lang.String type)

    String[] types = getTypes(classname);
    for (int i = 0; i < types.length; ++i) {
        if (types[i] == type.intern()) {
        return true;
        }
    }
    return false;
    
private voidparseClassList(java.lang.String val, ClassnameFilter filter)

    java.util.StringTokenizer tkn =
        new java.util.StringTokenizer(val, " ,", false );
    while ( tkn.hasMoreTokens() ){
        String classname =
        util.LinkerUtil.sanitizeClassname( tkn.nextToken() );
        filter.includeName(classname);
    }