edu.iu.iv.modeling.tarl.publication.impl
Class DefaultPublicationDatabase

java.lang.Object
  |
  +--edu.iu.iv.modeling.tarl.publication.impl.DefaultPublicationDatabase
All Implemented Interfaces:
PublicationDatabase

public class DefaultPublicationDatabase
extends java.lang.Object
implements PublicationDatabase

This class defines a default implementation of PublicationDatabaseInterface. It uses a PublicationGroup to store the Publications.

Author:
Jeegar T Maru
See Also:
DefaultPublication, DefaultPublicationGroup, PublicationDatabase

Constructor Summary
DefaultPublicationDatabase()
          Creates a new instance for a PublicationDatabase
 
Method Summary
 void addPublication(int year, Topic topic, AuthorGroup authors)
          Adds a Publication to the group
 void addPublication(int year, Topic topic, AuthorGroup authors, PublicationGroup citations)
          Adds a Publication to the group
 Publication getNextPublication()
          Returns the next Publication in the database
 PublicationGroup getPublications()
          Returns the group of Publications in the Database
 boolean hasMorePublications()
          Tests whether the Database has more publications for iteration
 void removeAll()
          Removes all the Publications from the database
 void resetSearchIndex()
          Resets the Search Index so the Database can be searched iteratively
 int size()
          Returns the number of Publications in the Database
 java.lang.String toString()
          Returns the details of the PublicationDatabase as a String
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultPublicationDatabase

public DefaultPublicationDatabase()
Creates a new instance for a PublicationDatabase

Method Detail

addPublication

public void addPublication(int year,
                           Topic topic,
                           AuthorGroup authors)
                    throws TarlException
Adds a Publication to the group

Specified by:
addPublication in interface PublicationDatabase
Parameters:
year - Specifies the year of publication
topic - Specifies the topic of the publication
authors - Specifies the authors who have collaborated for the publication
Throws:
TarlException - if the new publication cannot be initialized

addPublication

public void addPublication(int year,
                           Topic topic,
                           AuthorGroup authors,
                           PublicationGroup citations)
                    throws TarlException
Adds a Publication to the group

Specified by:
addPublication in interface PublicationDatabase
Parameters:
year - Specifies the year of publication
topic - Specifies the topic of the publication
authors - Specifies the authors who have collaborated for the publication
citations - Specifies the publications that this publication cites
Throws:
TarlException - if the new publication cannot be initialized

removeAll

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

Specified by:
removeAll in interface PublicationDatabase

getPublications

public PublicationGroup getPublications()
Returns the group of Publications in the Database

Specified by:
getPublications in interface PublicationDatabase
Returns:
the group of Publications in the Database

size

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

Specified by:
size in interface PublicationDatabase
Returns:
the number of publications in the Database

resetSearchIndex

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

Specified by:
resetSearchIndex in interface PublicationDatabase

hasMorePublications

public boolean hasMorePublications()
Tests whether the Database has more publications for iteration

Specified by:
hasMorePublications in interface PublicationDatabase
Returns:
true if the Database has more publications to iterate over

getNextPublication

public Publication getNextPublication()
                               throws java.util.NoSuchElementException
Returns the next Publication in the database

Specified by:
getNextPublication in interface PublicationDatabase
Returns:
the next publication of the iteration
Throws:
java.util.NoSuchElementException - if the iteration has no more publications

toString

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

Overrides:
toString in class java.lang.Object
Returns:
a String describing the PublicationDatabase