edu.iu.iv.modeling.tarl.topic.impl
Class DefaultTopicDatabase

java.lang.Object
  |
  +--edu.iu.iv.modeling.tarl.topic.impl.DefaultTopicDatabase
All Implemented Interfaces:
TopicDatabase

public class DefaultTopicDatabase
extends java.lang.Object
implements TopicDatabase

This class defines a default implementation of TopicDatabaseInterface. It uses an instance of DefaultTopicGroup to store all the topics.

Author:
Jeegar T Maru
See Also:
DefaultTopic, DefaultTopicGroup

Constructor Summary
DefaultTopicDatabase()
          Creates a new instance for a TopicDatabase
 
Method Summary
 void addTopic()
          Adds a Topic to the list
 Topic getNextTopic()
          Returns the next Topic in the database
 TopicGroup getTopics()
          Returns the list of Topics in the Database
 boolean hasMoreTopics()
          Tests whether the Database has more Topics for iteration
 void removeAll()
          Removes all the Topics from the database
 void resetSearchIndex()
          Resets the Search Index so the Database can be searched iteratively
 int size()
          Returns the number of Topics in the Database
 java.lang.String toString()
          Returns the details of the TopicDatabase as a String
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultTopicDatabase

public DefaultTopicDatabase()
Creates a new instance for a TopicDatabase

Method Detail

addTopic

public void addTopic()
Adds a Topic to the list

Specified by:
addTopic in interface TopicDatabase

removeAll

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

Specified by:
removeAll in interface TopicDatabase

getTopics

public TopicGroup getTopics()
Returns the list of Topics in the Database

Specified by:
getTopics in interface TopicDatabase
Returns:
the list of topics in the database

size

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

Specified by:
size in interface TopicDatabase
Returns:
the number of topics in the database

resetSearchIndex

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

Specified by:
resetSearchIndex in interface TopicDatabase

hasMoreTopics

public boolean hasMoreTopics()
Tests whether the Database has more Topics for iteration

Specified by:
hasMoreTopics in interface TopicDatabase
Returns:
true if the database has more topics to iterate over

getNextTopic

public Topic getNextTopic()
                   throws java.util.NoSuchElementException
Returns the next Topic in the database

Specified by:
getNextTopic in interface TopicDatabase
Returns:
the next topic of the iteration
Throws:
java.util.NoSuchElementException - if the iteration has no more topics

toString

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

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