dragon.onlinedb
Class ArrayCollectionReader

java.lang.Object
  |
  +--dragon.onlinedb.ArrayCollectionReader
All Implemented Interfaces:
CollectionReader

public class ArrayCollectionReader
extends java.lang.Object
implements CollectionReader

Collection reader for reading multiple collection

Copyright: Copyright (c) 2005

Company: IST, Drexel University

Version:
1.0
Author:
Davis Zhou

Constructor Summary
ArrayCollectionReader()
           
 
Method Summary
 boolean addArticle(Article article)
           
 void close()
          Closes the collection reader and releases all occupied resources.
 Article getArticleByKey(java.lang.String key)
          Reads out the article according to its key
 ArticleParser getArticleParser()
          Gets the article parser of the collection reader
 Article getNextArticle()
          Collection readers only support forward-only read mode.
 void restart()
          The collection reader supports forward-only read mode.
 void setArticleParser(ArticleParser parser)
          Sets the article parse for the collection reader
 boolean supportArticleKeyRetrieval()
          if the query supports this retrieval mode, one can get articles by calling getArticleByKey method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayCollectionReader

public ArrayCollectionReader()
Method Detail

getArticleParser

public ArticleParser getArticleParser()
Description copied from interface: CollectionReader
Gets the article parser of the collection reader

Specified by:
getArticleParser in interface CollectionReader
Returns:
the article parser

setArticleParser

public void setArticleParser(ArticleParser parser)
Description copied from interface: CollectionReader
Sets the article parse for the collection reader

Specified by:
setArticleParser in interface CollectionReader
Parameters:
parser - the article parser

close

public void close()
Description copied from interface: CollectionReader
Closes the collection reader and releases all occupied resources.

Specified by:
close in interface CollectionReader

getNextArticle

public Article getNextArticle()
Description copied from interface: CollectionReader
Collection readers only support forward-only read mode. When one call this method after calling restart method or creating the collection reader, it actually return the first article of the collection.

Specified by:
getNextArticle in interface CollectionReader
Returns:
the next article

getArticleByKey

public Article getArticleByKey(java.lang.String key)
Description copied from interface: CollectionReader
Reads out the article according to its key

Specified by:
getArticleByKey in interface CollectionReader
Parameters:
key - the unique entry number of the article
Returns:
an article if exists

addArticle

public boolean addArticle(Article article)

supportArticleKeyRetrieval

public boolean supportArticleKeyRetrieval()
Description copied from interface: CollectionReader
if the query supports this retrieval mode, one can get articles by calling getArticleByKey method.

Specified by:
supportArticleKeyRetrieval in interface CollectionReader
Returns:
true if the query support the article retrieval by key.

restart

public void restart()
Description copied from interface: CollectionReader
The collection reader supports forward-only read mode. If one wants to scan the collection for the second time, it is required to call this method. Otherwise when one getNextArticle method, it always return null.

Specified by:
restart in interface CollectionReader