org.pfsw.text
Class StringFilterCollection

java.lang.Object
  extended by org.pfsw.text.AStringFilter
      extended by org.pfsw.text.StringFilterCollection
All Implemented Interfaces:
org.pfsw.bif.filter.IObjectFilter<java.lang.String>, org.pfsw.bif.text.IStringFilter

public class StringFilterCollection
extends AStringFilter

A collection of IStringFilter objects that can be matched against strings according to a defined boolean operator (AND | OR | XOR).


Field Summary
static org.pfsw.bif.logic.BooleanOperation DEFAULT_OPERATION
           
 
Fields inherited from interface org.pfsw.bif.text.IStringFilter
ALL, NONE
 
Constructor Summary
StringFilterCollection()
          Creates a new empty instance with default boolean operation BooleanOperation.OR.
StringFilterCollection(org.pfsw.bif.logic.BooleanOperation operation)
          Creates a new empty instance with specified boolean operation BooleanOperation.OR.
StringFilterCollection(org.pfsw.bif.logic.BooleanOperation operation, org.pfsw.bif.text.IStringFilter... filters)
          Creates a new instance with the specified boolean operation that will be filled with the given filters.
StringFilterCollection(org.pfsw.bif.text.IStringFilter... filters)
          Creates a new instance with default boolean operation BooleanOperation.OR that will be filled with the given filters.
 
Method Summary
 void addFilters(org.pfsw.bif.text.IStringFilter... filters)
          Adds all given filters to this collection.
 java.util.List<org.pfsw.bif.text.IStringFilter> asList()
          Returns a list with all currently held filters.
 void clear()
           
protected  java.util.List<org.pfsw.bif.text.IStringFilter> getFilterList()
           
 org.pfsw.bif.logic.BooleanOperation getOperation()
           
 boolean isEmpty()
           
 boolean matches(java.lang.String aString)
           
protected  boolean matchesAllFilters(java.lang.String aString)
           
protected  boolean matchesAnyFilter(java.lang.String aString)
           
protected  boolean matchesOneFilter(java.lang.String aString)
           
 void setOperation(org.pfsw.bif.logic.BooleanOperation operation)
          Set the boolean operation the filter results must combined with.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_OPERATION

public static final org.pfsw.bif.logic.BooleanOperation DEFAULT_OPERATION
Constructor Detail

StringFilterCollection

public StringFilterCollection()
Creates a new empty instance with default boolean operation BooleanOperation.OR.


StringFilterCollection

public StringFilterCollection(org.pfsw.bif.logic.BooleanOperation operation)
Creates a new empty instance with specified boolean operation BooleanOperation.OR.


StringFilterCollection

public StringFilterCollection(org.pfsw.bif.text.IStringFilter... filters)
Creates a new instance with default boolean operation BooleanOperation.OR that will be filled with the given filters.


StringFilterCollection

public StringFilterCollection(org.pfsw.bif.logic.BooleanOperation operation,
                              org.pfsw.bif.text.IStringFilter... filters)
Creates a new instance with the specified boolean operation that will be filled with the given filters.

Method Detail

matches

public boolean matches(java.lang.String aString)

addFilters

public void addFilters(org.pfsw.bif.text.IStringFilter... filters)
Adds all given filters to this collection.


size

public int size()

isEmpty

public boolean isEmpty()

clear

public void clear()

getOperation

public org.pfsw.bif.logic.BooleanOperation getOperation()

setOperation

public void setOperation(org.pfsw.bif.logic.BooleanOperation operation)
Set the boolean operation the filter results must combined with.

Parameters:
operation - The operation (must not be null).
Throws:
java.lang.IllegalArgumentException - If the given operation is null.

asList

public java.util.List<org.pfsw.bif.text.IStringFilter> asList()
Returns a list with all currently held filters.


matchesAnyFilter

protected boolean matchesAnyFilter(java.lang.String aString)

matchesAllFilters

protected boolean matchesAllFilters(java.lang.String aString)

matchesOneFilter

protected boolean matchesOneFilter(java.lang.String aString)

getFilterList

protected java.util.List<org.pfsw.bif.text.IStringFilter> getFilterList()