com.sciapp.filter
Interface Filter

All Known Implementing Classes:
BooleanFilter, NumericFilter, StringFilter

public interface Filter

This interface defines the methods any general filter should implement. 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.

The rules are specified by setPattern and setMode. setPattern defines an abstract object to be used as the filter pattern and setMode defines the operation mode of the filter. e.g. StringFilter has 3 modes: EQUALS, CONTAINS and BEGINS_WITH.


Method Summary
 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(Object pattern)
          Defines an abstract object to be used as the filter pattern.
 

Method Detail

accept

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

Parameters:
o - the object we want to match
Returns:
true if the object matched

getDescriptions

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.

Returns:
the filter options.

getMode

int getMode()
Returns the current filter operation mode.

Returns:
the mode the filter is in.

getPattern

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

Returns:
the current filter pattern

setMode

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

Parameters:
mode - the operation mode

setPattern

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

Parameters:
pattern - the filter pattern