|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--edu.iu.iv.modeling.tarl.topic.impl.DefaultTopicGroup
This class defines the Group of Topics. It provides facilities for duplicate detection, and for iterating over the group. It also provides some sophisticated Group operations (borrowed from ExtendedHashSet) such as union, intersection, random subgroup extraction, etc.
DefaultTopic,
ExtendedHashSet,
TopicGroup| Constructor Summary | |
DefaultTopicGroup()
Creates a new instance of an empty TopicGroup |
|
DefaultTopicGroup(TopicGroup topics)
Creates a new instance for a TopicGroup as an exact replica of the specified TopicGroup object |
|
| Method Summary | |
void |
addTopic(Topic topic)
Adds a Topic to the group only if it is not already present in the group |
static boolean |
areSetEqual(TopicGroup topic_group1,
TopicGroup topic_group2)
Tests whether the two TopicGroups are equal or not in terms of Set Equality. |
boolean |
containsTopic(Topic topic)
Tests whether the Group contains the Topic or not |
void |
difference(TopicGroup topic_group)
Modifies the Group to be the difference of the current TopicGroup and the specified TopicGroup. |
static TopicGroup |
difference(TopicGroup topic_group1,
TopicGroup topic_group2)
Returns the difference of the two specified TopicGroups. |
java.util.Iterator |
getIterator()
Returns the Iterator over the Group of Topics |
Topic |
getRandomTopic()
Returns a Random Topic from the TopicGroup |
TopicGroup |
getRandomTopics(int num_elements)
Returns the specified number of different random Topics from the TopicGroup as a TopicGroup. |
java.util.Collection |
getTopics()
Returns the Group of Topics |
void |
initialize(java.util.Collection collection)
Initializes the group of Topics with the specified Collection |
void |
intersection(TopicGroup topic_group)
Modifies the TopicGroup to be the intersection of the Group and the specified TopicGroup. |
static TopicGroup |
intersection(TopicGroup topic_group1,
TopicGroup topic_group2)
Returns the intersection of two specified TopicGroups. |
static boolean |
isSubset(TopicGroup topic_group1,
TopicGroup topic_group2)
Tests whether the TopicGroup |
void |
removeAllTopics()
Removes all the Topics from the Group |
boolean |
removeTopic(Topic topic)
Removes the Topic from the Group |
int |
size()
Returns the number of topics in the Group |
java.lang.String |
toString()
Returns the details of the TopicGroup as a String |
void |
union(TopicGroup topic_group)
Modifies the TopicGroup to be the union of itself and the specified TopicGroup. |
static TopicGroup |
union(TopicGroup topic_group1,
TopicGroup topic_group2)
Returns the union of two specified TopicGroups as a TopicGroup. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public DefaultTopicGroup()
TopicGroup
public DefaultTopicGroup(TopicGroup topics)
throws java.lang.NullPointerException
TopicGroup as an exact replica of the specified TopicGroup object
topics - Specifies the topic group to be replicated
java.lang.NullPointerException - if the parameter topics is null| Method Detail |
public void initialize(java.util.Collection collection)
Topics with the specified Collection
initialize in interface TopicGroupcollection - Specifies the collection of topicspublic java.util.Collection getTopics()
Topics
getTopics in interface TopicGrouppublic java.util.Iterator getIterator()
Iterator over the Group of Topics
getIterator in interface TopicGrouppublic int size()
size in interface TopicGrouppublic void addTopic(Topic topic)
Topic to the group only if it is not already present in the group
addTopic in interface TopicGrouptopic - Specifies the topic to be addedpublic boolean containsTopic(Topic topic)
Topic or not
containsTopic in interface TopicGrouptopic - Specifies the topic to be tested
public boolean removeTopic(Topic topic)
Topic from the Group
topic - Specifies the topic to be removed
public void removeAllTopics()
Topics from the Group
removeAllTopics in interface TopicGrouppublic Topic getRandomTopic()
Topic from the TopicGroup
getRandomTopic in interface TopicGrouppublic TopicGroup getRandomTopics(int num_elements)
Topics from the TopicGroup as a TopicGroup. If the specified number is larger than the size of the TopicGroup, the entire TopicGroup is returned.
num_elements - Specifies the number of topics required
public void union(TopicGroup topic_group)
TopicGroup to be the union of itself and the specified TopicGroup. It acts like the operation (a = a union b), where a is the current TopicGroup and b is the specified TopicGroup
topic_group - Specifies the topic group to be unioned with
public static TopicGroup union(TopicGroup topic_group1,
TopicGroup topic_group2)
TopicGroups as a TopicGroup. Does not change any of the AuthroGroups.
topic_group1 - Specifies the first topic grouptopic_group2 - Specifies the second topic group
public void intersection(TopicGroup topic_group)
TopicGroup to be the intersection of the Group and the specified TopicGroup. It acts like the operation (a = a intersection b), where a is the current TopicGroup and b is the specified TopicGroup
topic_group - Specifies the topic group to be intersected with
public static TopicGroup intersection(TopicGroup topic_group1,
TopicGroup topic_group2)
TopicGroups. Does not change any of the TopicGroups.
topic_group1 - Specifies the first topic grouptopic_group2 - Specifies the second topic group
public void difference(TopicGroup topic_group)
TopicGroup and the specified TopicGroup. It acts like the operation (a = a - b), where a is the current TopicGroup and b is the specified TopicGroup
- Parameters:
topic_group - Specifies the topic group to be intersected with
public static TopicGroup difference(TopicGroup topic_group1,
TopicGroup topic_group2)
TopicGroups. Does not change any of the TopicGroups. The operation can be expressed as (a - b), where a and b are the TopicGroups as defined by the first and second argument respectively.
topic_group1 - Specifies the first topic grouptopic_group2 - Specifies the second topic group
public static boolean isSubset(TopicGroup topic_group1,
TopicGroup topic_group2)
TopicGroup specified by the second argument is a subset of the TopicGroup specified by the first argument
- Parameters:
topic_group1 - Specifies the first topic grouptopic_group2 - Specifies the second topic group
- Returns:
- true, if topic_group2 is a subset of topic_group1
public static boolean areSetEqual(TopicGroup topic_group1,
TopicGroup topic_group2)
TopicGroups are equal or not in terms of Set Equality. Two topicgroups are Group Equal if first is the subgroup of the second and the second is a subgroup of the first.
topic_group1 - Specifies the first topic grouptopic_group2 - Specifies the second topic group
public java.lang.String toString()
TopicGroup as a String
toString in class java.lang.Object
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||