|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--edu.iu.iv.modeling.tarl.author.impl.DefaultAuthorGroup
This class defines a default implementation of AuthorGroupInterface using the ExtendedHashSet.
ExtendedHashSet,
AuthorGroup| Constructor Summary | |
DefaultAuthorGroup()
Creates a new instance of an empty AuthorGroup |
|
DefaultAuthorGroup(AuthorGroup authors)
Creates a new instance for a AuthorGroup as an exact replica of the specified AuthorGroup object |
|
| Method Summary | |
void |
addAuthor(Author author)
Adds an Author to the group only if it is not already present in the group |
static boolean |
areSetEqual(AuthorGroup author_group1,
AuthorGroup author_group2)
Tests whether the two AuthorGroups are equal or not in terms of Set Equality. |
boolean |
containsAuthor(Author author)
Tests whether the Group contains the Author or not |
void |
difference(AuthorGroup author_group)
Modifies the Group to be the difference of the current AuthorGroup and the specified AuthorGroup. |
static AuthorGroup |
difference(AuthorGroup author_group1,
AuthorGroup author_group2)
Returns the difference of the two specified AuthorGroups. |
java.util.Collection |
getAuthors()
Returns the Group of Authors |
java.util.Iterator |
getIterator()
Returns the Iterator over the Group of Authors |
Author |
getRandomAuthor()
Returns a Random Author from the AuthorGroup |
AuthorGroup |
getRandomAuthors(int num_elements)
Returns the specified number of different random Authors from the AuthorGroup as an AuthorGroup. |
void |
initialize(java.util.Collection collection)
Initializes the group of Authors with the specified Collection |
void |
intersection(AuthorGroup author_group)
Modifies the AuthorGroup to be the intersection of the Group and the specified AuthorGroup. |
static AuthorGroup |
intersection(AuthorGroup author_group1,
AuthorGroup author_group2)
Returns the intersection of two specified AuthorGroups. |
static boolean |
isSubset(AuthorGroup author_group1,
AuthorGroup author_group2)
Tests whether the AuthorGroup |
void |
removeAllAuthors()
Removes all the Authors from the Group |
boolean |
removeAuthor(Author author)
Removes the Author from the Group |
int |
size()
Returns the number of authors in the Group |
java.lang.String |
toString()
Returns the details of the AuthorGroup as a String |
void |
union(AuthorGroup author_group)
Modifies the AuthorGroup to be the union of itself and the specified AuthorGroup. |
static AuthorGroup |
union(AuthorGroup author_group1,
AuthorGroup author_group2)
Returns the union of two specified AuthorGroups as an AuthorGroup. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public DefaultAuthorGroup()
AuthorGroup
public DefaultAuthorGroup(AuthorGroup authors)
throws java.lang.NullPointerException
AuthorGroup as an exact replica of the specified AuthorGroup object
authors - Specifies the author set to be replicated
java.lang.NullPointerException - if the parameter authors is null| Method Detail |
public void initialize(java.util.Collection collection)
Authors with the specified Collection
initialize in interface AuthorGroupcollection - Specifies the collection of authorspublic java.util.Collection getAuthors()
Authors
getAuthors in interface AuthorGrouppublic java.util.Iterator getIterator()
Iterator over the Group of Authors
getIterator in interface AuthorGrouppublic int size()
size in interface AuthorGrouppublic void addAuthor(Author author)
Author to the group only if it is not already present in the group
addAuthor in interface AuthorGroupauthor - Specifies the author to be addedpublic boolean containsAuthor(Author author)
Author or not
containsAuthor in interface AuthorGroupauthor - Specifies the author to be tested
public boolean removeAuthor(Author author)
Author from the Group
author - Specifies the author to be removed
public void removeAllAuthors()
Authors from the Group
removeAllAuthors in interface AuthorGrouppublic Author getRandomAuthor()
Author from the AuthorGroup
getRandomAuthor in interface AuthorGrouppublic AuthorGroup getRandomAuthors(int num_elements)
Authors from the AuthorGroup as an AuthorGroup. If the specified number is larger than the size of the AuthorGroup, the entire AuthorGroup is returned.
num_elements - Specifies the number of authors required
public void union(AuthorGroup author_group)
AuthorGroup to be the union of itself and the specified AuthorGroup. It acts like the operation (a = a union b), where a is the current AuthorGroup and b is the specified AuthorGroup
author_group - Specifies the author group to be unioned with
public static AuthorGroup union(AuthorGroup author_group1,
AuthorGroup author_group2)
AuthorGroups as an AuthorGroup. Does not change any of the AuthroGroups.
author_group1 - Specifies the first author groupauthor_group2 - Specifies the second author group
public void intersection(AuthorGroup author_group)
AuthorGroup to be the intersection of the Group and the specified AuthorGroup. It acts like the operation (a = a intersection b), where a is the current AuthorGroup and b is the specified AuthorGroup
author_group - Specifies the author group to be intersected with
public static AuthorGroup intersection(AuthorGroup author_group1,
AuthorGroup author_group2)
AuthorGroups. Does not change any of the AuthorGroups.
author_group1 - Specifies the first author groupauthor_group2 - Specifies the second author group
public void difference(AuthorGroup author_group)
AuthorGroup and the specified AuthorGroup. It acts like the operation (a = a - b), where a is the current AuthorGroup and b is the specified AuthorGroup
- Parameters:
author_group - Specifies the author group to be intersected with
public static AuthorGroup difference(AuthorGroup author_group1,
AuthorGroup author_group2)
AuthorGroups. Does not change any of the AuthorGroups. The operation can be expressed as (a - b), where a and b are the AuthorGroups as defined by the first and second argument respectively.
author_group1 - Specifies the first author groupauthor_group2 - Specifies the second author group
public static boolean isSubset(AuthorGroup author_group1,
AuthorGroup author_group2)
AuthorGroup specified by the second argument is a subset of the AuthorGroup specified by the first argument
- Parameters:
author_group1 - Specifies the first author groupauthor_group2 - Specifies the second author group
- Returns:
- true, if author_group2 is a subset of author_group1
public static boolean areSetEqual(AuthorGroup author_group1,
AuthorGroup author_group2)
AuthorGroups are equal or not in terms of Set Equality. Two authorgroups are Set Equal if first is the subset of the second and the second is a subset of the first.
author_group1 - Specifies the first author groupauthor_group2 - Specifies the second author group
public java.lang.String toString()
AuthorGroup 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 | ||||||||||