com.sciapp.filter
Class BooleanFilter

java.lang.Object
  extended by com.sciapp.filter.BooleanFilter
All Implemented Interfaces:
Filter

public class BooleanFilter
extends Object
implements Filter

A boolean filter. This filter does not depend on a pattern object. It performs filtering according to the operation mode, which can be either TRUE or FALSE.


Field Summary
static int FALSE
          The mode that tests if a boolean value is false.
protected  int mode
          The current filter mode.
protected  String[] options
          The options presented to the user.
protected  boolean pattern
          The filter pattern used as a boolean value.
static int TRUE
          The mode that tests if a boolean value is true.
 
Constructor Summary
BooleanFilter()
          Constructs a BooleanFilter.
 
Method Summary
 boolean accept(boolean b)
          Matches the boolean value b against the current filter.
 boolean accept(Object o)
          Matches a specified object against the current filter.
 String[] getDescriptions()
          Returns a string array representing the filter options presented to the user.
 int getMode()
          Returns the current filter operation mode.
 Object getPattern()
          Returns the object used as the filter pattern.
 void setMode(int mode)
          Sets the operation mode of the filter.
 void setPattern(boolean pattern)
          Sets the filter pattern as a boolean value.
 void setPattern(Object pattern)
          Defines an abstract object to be used as the filter pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE

public static final int TRUE
The mode that tests if a boolean value is true.

See Also:
Constant Field Values

FALSE

public static final int FALSE
The mode that tests if a boolean value is false.

See Also:
Constant Field Values

pattern

protected boolean pattern
The filter pattern used as a boolean value.


mode

protected int mode
The current filter mode.


options

protected String[] options
The options presented to the user.

Constructor Detail

BooleanFilter

public BooleanFilter()
Constructs a BooleanFilter.

Method Detail

accept

public boolean accept(Object o)
Matches a specified object against the current filter.

Specified by:
accept in interface Filter
Parameters:
o - the object we want to match
Returns:
true if the object matched

accept

public boolean accept(boolean b)
Matches the boolean value b against the current filter.

Parameters:
b - a boolean value
Returns:
true if the value matched

getDescriptions

public String[] getDescriptions()
Returns a string array representing the filter options presented to the user. The index of each element in this array corresponds to the operation mode of the filter.

Specified by:
getDescriptions in interface Filter
Returns:
the filter options.

getMode

public int getMode()
Returns the current filter operation mode.

Specified by:
getMode in interface Filter
Returns:
the mode the filter is in.

getPattern

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

Specified by:
getPattern in interface Filter
Returns:
the current filter pattern

setMode

public void setMode(int mode)
Sets the operation mode of the filter.

Specified by:
setMode in interface Filter
Parameters:
mode - the operation mode

setPattern

public void setPattern(Object pattern)
Defines an abstract object to be used as the filter pattern.

Specified by:
setPattern in interface Filter
Parameters:
pattern - the filter pattern

setPattern

public void setPattern(boolean pattern)
Sets the filter pattern as a boolean value.

Parameters:
pattern - the filter pattern