Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.filter
Class Filter

java.lang.Object
  extended by com.citra.filter.Filter
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
BlockFilter, BooleanFilter, ComparisonFilter, PassFilter, StringFilter

public abstract class Filter
extends Object
implements Serializable

This abstract class defines a filter.

The function of a filter is simple: given an object as argument, it tests whether the object matches the filter's set of rules, by calling the accept method.

See Also:
Serialized Form

Field Summary
protected  boolean acceptNull
          boolean indicating if the filter is going to accept null values.
 
Constructor Summary
Filter()
          Creates a Filter object that will not accept null values.
 
Method Summary
abstract  boolean accept(Object o)
          Decides whether to accept the value supplied.
 boolean getAcceptNull()
          Returns true if the filter should let null values pass through.
abstract  Object getFilterPattern()
          Returns the object used as the filter pattern.
 void setAcceptNull(boolean acceptNull)
          Sets the behaviour of the filter when null values are passed in the accept method.
abstract  void setFilterPattern(Object filter)
          Sets an object as the filter pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

acceptNull

protected boolean acceptNull
boolean indicating if the filter is going to accept null values.

Constructor Detail

Filter

public Filter()
Creates a Filter object that will not accept null values.

Method Detail

accept

public abstract boolean accept(Object o)
Decides whether to accept the value supplied.

Parameters:
o - the object we want to decide if it will be filtered or not.
Returns:
true if the object matched and should not be filtered out, false otherwise.

getAcceptNull

public boolean getAcceptNull()
Returns true if the filter should let null values pass through.

Returns:
a boolean

getFilterPattern

public abstract Object getFilterPattern()
Returns the object used as the filter pattern.

Returns:
the object that is currently set as the filter pattern.

setAcceptNull

public void setAcceptNull(boolean acceptNull)
Sets the behaviour of the filter when null values are passed in the accept method. If acceptNull is true, the filter should let null values pass through, filter them out otherwise.

Parameters:
acceptNull - a boolean

setFilterPattern

public abstract void setFilterPattern(Object filter)
Sets an object as the filter pattern. Subclasses should provide an implementation that will probably first cast filter to the appropriate object.

Parameters:
filter - the object to set as the filter pattern

Copyright © 2011 Citra Technologies. All Rights Reserved.