corny.addressbook.searching.Filter
Class MetaFilter

java.lang.Object
  extended by corny.addressbook.searching.Filter.Filter
      extended by corny.addressbook.searching.Filter.MetaFilter

public class MetaFilter
extends Filter

Filter class to combine multiple Filters to a more complex one.

Each Filter represents a comparison. Using the MetaFilter class, multiple comparisons can be combined using the conjunctions AND / OR.

Author:
Corny

Field Summary
static boolean AND
          Conjunction
static boolean OR
          Disjunction
 
Constructor Summary
MetaFilter(boolean conjunction, Filter[] children)
          Creates a new MetaFilter with the specified conjunction and child Filters.
 
Method Summary
 boolean appliesToFilter(Contact c)
          Used by NativeAddressBook to determine whether the Contact matches the search query
 java.lang.String toString()
           
 
Methods inherited from class corny.addressbook.searching.Filter.Filter
createFilter
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AND

public static final boolean AND
Conjunction

See Also:
Constant Field Values

OR

public static final boolean OR
Disjunction

See Also:
Constant Field Values
Constructor Detail

MetaFilter

public MetaFilter(boolean conjunction,
                  Filter[] children)
Creates a new MetaFilter with the specified conjunction and child Filters.

Parameters:
conjunction - Either MetaFilter.AND or MetaFilter.OR
children - Child filter to be combined using the given conjunction
Method Detail

appliesToFilter

public boolean appliesToFilter(Contact c)
Description copied from class: Filter
Used by NativeAddressBook to determine whether the Contact matches the search query

Specified by:
appliesToFilter in class Filter
Parameters:
c - Contact to compare
Returns:
True, if the Contact matches the search query

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object