edu.iu.iv.modeling.tarl.util.impl
Class DefaultAuthorsTopicBucket

java.lang.Object
  |
  +--edu.iu.iv.modeling.tarl.util.impl.DefaultAuthorsTopicBucket
All Implemented Interfaces:
AuthorsTopicBucket

public class DefaultAuthorsTopicBucket
extends java.lang.Object
implements AuthorsTopicBucket

This class is a default implemention of the AuthorsTopicBucketInterface.
It represents the group of Authors as an instance of DefaultAuthorGroup. It represents the Topic as an instance of DefaultTopic.

Author:
Jeegar T Maru
See Also:
AuthorGroup, Topic, AuthorsTopicBucket

Constructor Summary
DefaultAuthorsTopicBucket()
          Creates a new empty instance of AuthorsTopicBucket.
 
Method Summary
 void addAuthor(Author author)
          Adds an Author only if his/her Topic is the same as that of the Bucket.
 AuthorGroup getAuthors()
          Returns the AuthorGroup that the AuthorsTopicBucket stores
 Topic getTopic()
          Returns the common Topic of the AuthorGroup
 void initialize(java.util.Collection collection)
          Initializes the Bucket with Authors from the collection
 java.util.Collection partitionBucket(int numElements)
          Partitions the bucket to fixed sized groups of Authors and returns the Collection of these groups.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAuthorsTopicBucket

public DefaultAuthorsTopicBucket()
Creates a new empty instance of AuthorsTopicBucket. The common Topic is set to null.

Method Detail

initialize

public void initialize(java.util.Collection collection)
Initializes the Bucket with Authors from the collection

Specified by:
initialize in interface AuthorsTopicBucket
Parameters:
collection - Specifies the collection of authors

addAuthor

public void addAuthor(Author author)
Adds an Author only if his/her Topic is the same as that of the Bucket.

Specified by:
addAuthor in interface AuthorsTopicBucket
Parameters:
author - the author to be added to the bucket

getTopic

public Topic getTopic()
Returns the common Topic of the AuthorGroup

Specified by:
getTopic in interface AuthorsTopicBucket
Returns:
the common topic of the authors

getAuthors

public AuthorGroup getAuthors()
Returns the AuthorGroup that the AuthorsTopicBucket stores

Specified by:
getAuthors in interface AuthorsTopicBucket
Returns:
the group of authors

partitionBucket

public java.util.Collection partitionBucket(int numElements)
Partitions the bucket to fixed sized groups of Authors and returns the Collection of these groups.
The method uses the static method tarl.defaultimpl.misc.ExtendedHashSet#partitionSet(Collection collection, int numElements) available with the ExtendedHashSet.

Specified by:
partitionBucket in interface AuthorsTopicBucket
Parameters:
numElements - the number of elements in most of the individual buckets
Returns:
a collection of AuthorsTopicBuckets