com.sciapp.filter
Class NumericFilter

java.lang.Object
  extended by com.sciapp.filter.Filter
      extended by com.sciapp.filter.ComparisonFilter
          extended by com.sciapp.filter.NumericFilter

public class NumericFilter
extends ComparisonFilter

A numeric filter that matches the integer part of the Number objects supplied.


Field Summary
protected  int value
          the integer value the supplied objects are matched against.
 
Fields inherited from class com.sciapp.filter.ComparisonFilter
comparison, EQ, GE, GT, LE, LT
 
Fields inherited from class com.sciapp.filter.Filter
acceptNull
 
Constructor Summary
NumericFilter()
          Constructs a NumericFilter with an EQUAL_TO mode and a value of 0 as the integer value to match against.
 
Method Summary
 boolean accept(int i)
          Matches the integer value i against the current filter.
 boolean accept(Object value)
          Decides whether to accept the value supplied.
 Object getFilterPattern()
          Returns the object used as the filter pattern.
 int getNumber()
          Returns the integer value used to match against Number objects.
 void setFilterPattern(Object filter)
          Sets an object as the filter pattern.
 void setNumber(int i)
          Sets the integer value used to match against Number objects.
 
Methods inherited from class com.sciapp.filter.ComparisonFilter
getComparison, setComparison
 
Methods inherited from class com.sciapp.filter.Filter
getAcceptNull, setAcceptNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

protected int value
the integer value the supplied objects are matched against.

Constructor Detail

NumericFilter

public NumericFilter()
Constructs a NumericFilter with an EQUAL_TO mode and a value of 0 as the integer value to match against.

Method Detail

accept

public boolean accept(int i)
Matches the integer value i against the current filter.

Parameters:
i - the integer to match
Returns:
true if the value matched

accept

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

Specified by:
accept in class Filter
Parameters:
value - 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.

getNumber

public int getNumber()
Returns the integer value used to match against Number objects.

Returns:
the integer value filter.

setNumber

public void setNumber(int i)
Sets the integer value used to match against Number objects.

Parameters:
i - the integer value filter.

setFilterPattern

public 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.

Specified by:
setFilterPattern in class Filter
Parameters:
filter - the object to set as the filter pattern

getFilterPattern

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

Specified by:
getFilterPattern in class Filter
Returns:
the object that is currently set as the filter pattern.