edu.iu.iv.modeling.tarl.author.impl
Class DefaultAuthorDatabase

java.lang.Object
  |
  +--edu.iu.iv.modeling.tarl.author.impl.DefaultAuthorDatabase
All Implemented Interfaces:
AuthorDatabase

public class DefaultAuthorDatabase
extends java.lang.Object
implements AuthorDatabase

This class defines a default implementation for AuthorDatabaseInterface. It stores a list of Authors as an instance of DefaultAuthorGroup.

Author:
Jeegar T Maru
See Also:
DefaultAuthorGroup, AuthorDatabase

Constructor Summary
DefaultAuthorDatabase()
          Creates a new instance for a AuthorDatabase
 
Method Summary
 void addAuthor(Topic topic)
          Adds an Author to the list
 void addAuthor(Topic topic, int maximum_age)
          Adds an Author to the list
 AuthorGroup getAuthors()
          Returns the list of Authors in the Database
 Author getNextAuthor()
          Returns the next Author in the database
 boolean hasMoreAuthors()
          Tests whether the Database has more authors for iteration
 void removeAll()
          Removes all the Authors from the database
 void resetSearchIndex()
          Resets the Search Index so the Database can be searched iteratively
 int size()
          Returns the number of Authors in the Database
 java.lang.String toString()
          Returns the details of the AuthorDatabase as a String
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultAuthorDatabase

public DefaultAuthorDatabase()
Creates a new instance for a AuthorDatabase

Method Detail

addAuthor

public void addAuthor(Topic topic)
               throws TarlException
Adds an Author to the list

Specified by:
addAuthor in interface AuthorDatabase
Parameters:
topic - Specifies the topic of the author
Throws:
TarlException - if the new author cannot be initialized

addAuthor

public void addAuthor(Topic topic,
                      int maximum_age)
               throws TarlException
Adds an Author to the list

Specified by:
addAuthor in interface AuthorDatabase
Parameters:
topic - Specifies the topic of the author
maximum_age - Specifies the maximum age of the author
Throws:
TarlException - if the new author cannot be initialized

removeAll

public void removeAll()
Removes all the Authors from the database

Specified by:
removeAll in interface AuthorDatabase

getAuthors

public AuthorGroup getAuthors()
Returns the list of Authors in the Database

Specified by:
getAuthors in interface AuthorDatabase
Returns:
the list of authors in the database

size

public int size()
Returns the number of Authors in the Database

Specified by:
size in interface AuthorDatabase
Returns:
the number of authors in the Database

resetSearchIndex

public void resetSearchIndex()
Resets the Search Index so the Database can be searched iteratively

Specified by:
resetSearchIndex in interface AuthorDatabase

hasMoreAuthors

public boolean hasMoreAuthors()
Tests whether the Database has more authors for iteration

Specified by:
hasMoreAuthors in interface AuthorDatabase
Returns:
true if the database has more authors to iterate over

getNextAuthor

public Author getNextAuthor()
                     throws java.util.NoSuchElementException
Returns the next Author in the database

Specified by:
getNextAuthor in interface AuthorDatabase
Returns:
the next author of the iteration
Throws:
java.util.NoSuchElementException - if the iteration has no more authors

toString

public java.lang.String toString()
Returns the details of the AuthorDatabase as a String

Overrides:
toString in class java.lang.Object
Returns:
a string describing the author database