FileDocCategorySizeDatePackage
Filter.javaAPI DocAndroid 1.5 API3353Wed May 06 22:41:10 BST 2009com.android.mkstubs

Filter

public class Filter extends Object
A "filter" holds the various patterns that MkStubs should accept (include) or reject (exclude). Patterns can be of two kind:
  • Full patterns are simple string matches, similar to a "^pattern$" regex.
  • Prefix patterns are partial string matches, similar to a "^pattern.*" regex.

The {@link #accept(String)} method examines a given string against the known pattern to decide if it should be included.

Fields Summary
private TreeSet
mIncludePrefix
private TreeSet
mIncludeFull
private TreeSet
mExcludePrefix
private TreeSet
mExcludeFull
Constructors Summary
Methods Summary
public booleanaccept(java.lang.String s)
Checks if the given string passes the various include/exclude rules. The matching is done as follows:
  • The string must match either a full include or a prefix include.
  • The string must not match any full exclude nor any prefix exclude.

param
s The string to accept or reject.
return
True if the string can be accepted, false if it must be rejected.

        
        // Check if it can be included.
        boolean accept = mIncludeFull.contains(s);
        if (!accept) {
            // Check for a prefix inclusion
            for (String prefix : mIncludePrefix) {
                if (s.startsWith(prefix)) {
                    accept = true;
                    break;
                }
            }
        }
        
        if (accept) {
            // check for a full exclusion
            accept = !mExcludeFull.contains(s);
        }
        if (accept) {
            // or check for prefix exclusion
            for (String prefix : mExcludePrefix) {
                if (s.startsWith(prefix)) {
                    accept = false;
                    break;
                }
            }
        }

        return accept;
    
public java.util.TreeSetgetExcludeFull()
Returns the set of all full patterns to be excluded.

        return mExcludeFull;
    
public java.util.TreeSetgetExcludePrefix()
Returns the set of all prefix patterns to be excluded.

        return mExcludePrefix;
    
public java.util.TreeSetgetIncludeFull()
Returns the set of all full patterns to be included.


                   
       
        return mIncludeFull;
    
public java.util.TreeSetgetIncludePrefix()
Returns the set of all prefix patterns to be included.

        return mIncludePrefix;