gishur.core
Class Filter

java.lang.Object
  |
  +--gishur.core.Filter
Direct Known Subclasses:
AdjacentFilter, ClassFilter, NameFilter

public class Filter
extends java.lang.Object

The Filter class provides a simple way to establish a pipeline of filters in a conjunctive way. This Filter class does not do any filtering at all; just overwrite the check(java.lang.Object)-method in order to build filter-pipelines (with functionality). To use a Filter pipeline, one have to call the valid(java.lang.Object) method at the first element.

Version:
1.0
Author:
Thomas Wolf

Constructor Summary
Filter()
          The basic Filter constructor.
 
Method Summary
 void addFilter(Filter f)
          Adds another Filter to the filter pipeline.
protected  boolean check(java.lang.Object obj)
          This method should be overwritten in order to perform the filtering.
 Filter nextFilter()
          Returns the next Filter in the pipe (the one docked to this one).
 void removeFilter(Filter f)
          Removes a Filter from the pipeline.
 boolean valid(java.lang.Object obj)
          Returns true, if the given Object is not filtered-out by this Filter-pipeline.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Filter

public Filter()
The basic Filter constructor.
Method Detail

nextFilter

public Filter nextFilter()
Returns the next Filter in the pipe (the one docked to this one).
Returns:
the next Filter in the pipe

addFilter

public final void addFilter(Filter f)
Adds another Filter to the filter pipeline. The added Filter will be tested, after all other Filters have performed their tests and have not declined the object.
Parameters:
f - the new Filter to add to the pipe

removeFilter

public final void removeFilter(Filter f)
Removes a Filter from the pipeline.
Parameters:
f - the Filter to be removed

valid

public final boolean valid(java.lang.Object obj)
Returns true, if the given Object is not filtered-out by this Filter-pipeline.
Parameters:
obj - the Object to be tested
Returns:
true, if the given Object is not filtered-out

check

protected boolean check(java.lang.Object obj)
This method should be overwritten in order to perform the filtering.
Parameters:
obj - the Object to be tested
Returns:
true, if the given Object is not filtered-out