fable.utility.strategy
Class DateFilter

java.lang.Object
  extended by fable.utility.strategy.DateFilter
All Implemented Interfaces:
FilterStrategy

public class DateFilter
extends java.lang.Object
implements FilterStrategy

DateFilter is a FilterStrategy that will only accept articles written between certain dates

Author:
Christopher Moh

Constructor Summary
DateFilter(java.util.Date startDate, java.util.Date endDate)
          Creates a new DateFilter.
 
Method Summary
 boolean isOk(FableComponent t)
          Determines if the FableComponent should be allowed in the filter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateFilter

public DateFilter(java.util.Date startDate,
                  java.util.Date endDate)
Creates a new DateFilter. NO Defensive copies are made of the Date references to this constructor. Modification of the underlying Date objects change the DateFilter This date filter will only allow articles with dates between the start and end date inclusive

Parameters:
startDate - start date
endDate - end date
Requires:
startDate, endDate != null
Effects:
Creates a new DateFilter
Modifies:
this
Method Detail

isOk

public boolean isOk(FableComponent t)
Description copied from interface: FilterStrategy
Determines if the FableComponent should be allowed in the filter

Specified by:
isOk in interface FilterStrategy
Parameters:
t - FableComponent to check
Returns:
true if the FableComponent is allowed to pass, false otherwise