Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.filter
Class DateFilter

java.lang.Object
  extended by com.sciapp.filter.Filter
      extended by com.sciapp.filter.ComparisonFilter
          extended by com.sciapp.filter.DateFilter
All Implemented Interfaces:
Serializable

public class DateFilter
extends ComparisonFilter

A date filter.

This class uses a DateComparator object to compare the Date values.

See Also:
Serialized Form

Field Summary
protected  Date date
          The date expression the supplied objects are matched against.
protected  DateComparator dc
          A Date comparator object used to compare Date values.
 
Fields inherited from class com.sciapp.filter.ComparisonFilter
comparison, EQ, GE, GT, LE, LT, NE
 
Fields inherited from class com.sciapp.filter.Filter
acceptNull
 
Constructor Summary
DateFilter()
          Constructs a DateFilter with an EQUAL_TO mode and with the date expression set to the current date.
DateFilter(Date date)
          Constructs a DateFilter with an EQUAL_TO mode and with the date expression set to date.
 
Method Summary
 boolean accept(Date d)
          Matches the Date value supplied against the date expression of the filter.
 boolean accept(Object value)
          Decides whether to accept the value supplied.
 Date getDate()
          Returns the current date expression of the filer.
 DateComparator getDateComparator()
          Returns the date comparator that is used when filtering.
 Object getFilterPattern()
          Returns the object used as the filter pattern.
 void setDate(Date d)
          Sets the date expression to d.
 void setFilterPattern(Object filter)
          Sets an object as the filter pattern.
 
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

date

protected Date date
The date expression the supplied objects are matched against.


dc

protected DateComparator dc
A Date comparator object used to compare Date values.

Constructor Detail

DateFilter

public DateFilter()
Constructs a DateFilter with an EQUAL_TO mode and with the date expression set to the current date.


DateFilter

public DateFilter(Date date)
Constructs a DateFilter with an EQUAL_TO mode and with the date expression set to date.

Method Detail

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.

accept

public boolean accept(Date d)
Matches the Date value supplied against the date expression of the filter.

Parameters:
d - the Date value to match
Returns:
true if the value matched

getDate

public Date getDate()
Returns the current date expression of the filer.

Returns:
the date expression.

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.

setDate

public void setDate(Date d)
Sets the date expression to d.

Parameters:
d - the date expression

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

getDateComparator

public DateComparator getDateComparator()
Returns the date comparator that is used when filtering.

Returns:
the date comparator

Copyright © 2005 Scientific Applications. All Rights Reserved.