edu.iu.iv.modeling.tarl.topic
Interface TopicGroup

All Known Implementing Classes:
DefaultTopicGroup

public interface TopicGroup

This interface defines the functions to represent a group of Topics. It should support various operations on a group of Topics like returning an iterator over the group, adding a Topic to the group, testing whether a Topic is a member of the group, retrieving random Topic, etc.
A major constraint on the TopicGroup is to include only Topics as its members.

Author:
Jeegar T Maru
See Also:
Topic

Method Summary
 void addTopic(Topic topic)
          Adds a Topic to the group
 boolean containsTopic(Topic topic)
          Tests whether the Group contains the Topic or not
 java.util.Iterator getIterator()
          Returns the Iterator over the Group of Topics.
 Topic getRandomTopic()
          Returns a random Topic from the Group
 java.util.Collection getTopics()
          Returns all the Topics in the group as a Collection
 void initialize(java.util.Collection collection)
          Initializes the group of Topics with the specified Collection
 void removeAllTopics()
          Removes all the Topic from the Group
 int size()
          Returns the number of Topics in the Group
 

Method Detail

initialize

public void initialize(java.util.Collection collection)
Initializes the group of Topics with the specified Collection

Parameters:
collection - Specifies the collection of topics

getIterator

public java.util.Iterator getIterator()
Returns the Iterator over the Group of Topics. The Iterator should iterate only over the non-duplicate members of the TopicGroup. The order of iteration does not matter as long as it covers all the non-duplicate members of the Group.

Returns:
the iterator over the group of topics

getTopics

public java.util.Collection getTopics()
Returns all the Topics in the group as a Collection

Returns:
the collection of all topics in the group

size

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

Returns:
the number of topics in the group

addTopic

public void addTopic(Topic topic)
Adds a Topic to the group

Parameters:
topic - Specifies the topic to be added

removeAllTopics

public void removeAllTopics()
Removes all the Topic from the Group


containsTopic

public boolean containsTopic(Topic topic)
Tests whether the Group contains the Topic or not

Parameters:
topic - Specifies the topic to be tested
Returns:
true, if the topic is contained in the group

getRandomTopic

public Topic getRandomTopic()
Returns a random Topic from the Group

Returns:
a random topic