fable.utility.strategy
Class FilterStrategyFactory

java.lang.Object
  extended by fable.utility.strategy.FilterStrategyFactory

public class FilterStrategyFactory
extends java.lang.Object

FilterStrategyFactory is a factory class to provide filters

Author:
Christopher Moh

Method Summary
static FilterStrategy acceptAll()
          Returns a filter strategy that accepts all kinds of articles
static FilterStrategy acceptAuthor(java.lang.String author)
          Returns a filter strategy that only allows articles written by a particular author through
static FilterStrategy acceptBetween(java.util.Date start, java.util.Date end)
          Returns a filter strategy that only allows articles between these two dates (inclusive)
static FilterStrategy acceptCensor(FableCensor x)
          Creates a filterStrategy from a FilterCensor
static FilterStrategy acceptCombined(java.util.Collection<FilterStrategy> x)
          Returns a combined filter strategy
static FilterStrategy acceptEndingAt(java.util.Date d)
          Returns a filter strategy that only allows articles ending at this date (inclusive)
static FilterStrategy acceptRead()
          Returns a filter strategy that only allows read articles through
static FilterStrategy acceptStarred()
          Returns a filter strategy that only allows starred articles through
static FilterStrategy acceptStartingFrom(java.util.Date d)
          Returns a filter strategy that only allows articles starting from this date (inclusive)
static FilterStrategy acceptUnread()
          Returns a filter strategy that only allows unread articles through
static FilterStrategy acceptUnStarred()
          Returns a filter strategy that only allows unstarred articles through
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

acceptAll

public static FilterStrategy acceptAll()
Returns a filter strategy that accepts all kinds of articles

Returns:
acceptAll filterStrategy

acceptStarred

public static FilterStrategy acceptStarred()
Returns a filter strategy that only allows starred articles through

Returns:
A starred filter strategy

acceptUnStarred

public static FilterStrategy acceptUnStarred()
Returns a filter strategy that only allows unstarred articles through

Returns:
An unstarred filter strategy

acceptUnread

public static FilterStrategy acceptUnread()
Returns a filter strategy that only allows unread articles through

Returns:
An unread filter strategy

acceptRead

public static FilterStrategy acceptRead()
Returns a filter strategy that only allows read articles through

Returns:
A read filter strategy

acceptAuthor

public static FilterStrategy acceptAuthor(java.lang.String author)
Returns a filter strategy that only allows articles written by a particular author through

Parameters:
author - The author whose articles are to be seen
Returns:
A filter strategy that only allows articles by this author
Requires:
author != null

acceptStartingFrom

public static FilterStrategy acceptStartingFrom(java.util.Date d)
Returns a filter strategy that only allows articles starting from this date (inclusive)

Parameters:
d - Date to start from
Returns:
A date filter strategy
Requires:
d != null

acceptEndingAt

public static FilterStrategy acceptEndingAt(java.util.Date d)
Returns a filter strategy that only allows articles ending at this date (inclusive)

Parameters:
d - Date to end at
Returns:
A date filter strategy
Requires:
d != null

acceptBetween

public static FilterStrategy acceptBetween(java.util.Date start,
                                           java.util.Date end)
Returns a filter strategy that only allows articles between these two dates (inclusive)

Parameters:
start - Date to start from
end - Date to end at
Returns:
A date filter strategy
Requires:
start, end != null

acceptCombined

public static FilterStrategy acceptCombined(java.util.Collection<FilterStrategy> x)
Returns a combined filter strategy

Parameters:
x - A list of filter strategies
Returns:
A combined filter strategy that only allows an article through if it passes all the filter strategies in the collection
Requires:
x != null, for all elements p in x, p != null

acceptCensor

public static FilterStrategy acceptCensor(FableCensor x)
Creates a filterStrategy from a FilterCensor

Parameters:
x - Censor to create strategy from
Returns:
A strategy that only returns articles allowed by this censor
Requires:
x != null