fable.utility
Class RSSSearcher

java.lang.Object
  extended by fable.utility.RSSSearcher

public class RSSSearcher
extends java.lang.Object

Class for RSS Searcher

An RSS Searcher will search all articles for keyword/article text.

Each RSS Searcher will occupy memory in a temporary directory. No two RSS searchers can occupy the same temporary directory. Attempting to create an RSS Searcher in an already occupied temporary directory will remove the old RSS Searcher in that directory.

Author:
Christopher Moh

Constructor Summary
RSSSearcher(java.util.List<FableComponent> ct, java.lang.String tempDir)
          Creates a new instance of an RSSSearcher for a given list of articles
 
Method Summary
 void close()
          Closes the search.
 java.util.List<FableComponent> searchArticle(java.lang.String keyString)
          Returns a List of FableComponent(s) where the keyString matches the entire article (summary + html content), or the keywords or authors
 java.util.List<FableComponent> searchKey(java.lang.String keyString)
          Returns a List of FableComponent(s) where the keyString matches the keywords or authors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSSSearcher

public RSSSearcher(java.util.List<FableComponent> ct,
                   java.lang.String tempDir)
            throws java.io.IOException
Creates a new instance of an RSSSearcher for a given list of articles

Parameters:
ct - List of articles to search
tempDir - the temporary directory this searcher should occupy
Throws:
java.io.IOException - if Searcher could not be created in the directory
Requires:
ct != null, for all elements x in ct, x != null, tempDir != null
Effects:
Creates a new RSSSearcher
Modifies:
this
Method Detail

close

public void close()
           throws java.io.IOException
Closes the search. This should always be done before a new search is created.

Throws:
java.io.IOException - if the directory the search is based on cannot be closed.

searchKey

public java.util.List<FableComponent> searchKey(java.lang.String keyString)
Returns a List of FableComponent(s) where the keyString matches the keywords or authors

Parameters:
keyString - The Key String to search for
Returns:
A list of FableComponent(s) that matches the Key String search. If an error is found during the search, an empty list is returned.
Requires:
keyString != null

searchArticle

public java.util.List<FableComponent> searchArticle(java.lang.String keyString)
Returns a List of FableComponent(s) where the keyString matches the entire article (summary + html content), or the keywords or authors

Parameters:
keyString - The string to search for
Returns:
A list of FableComponents that matches the search string. If an error is found during the search, an empty list is returned.
Requires:
keyString != null