edu.iu.iv.modeling.tarl.publication
Interface PublicationGroup

All Known Implementing Classes:
DefaultPublicationGroup

public interface PublicationGroup

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

Author:
Jeegar T Maru
See Also:
Publication

Method Summary
 void addPublication(Publication publication)
          Adds a Publication to the group
 boolean containsPublication(Publication publication)
          Tests whether the Group contains the Publication or not
 java.util.Iterator getIterator()
          Returns the Iterator over the Group of Publications.
 java.util.Collection getPublications()
          Returns the Collection of Publications in the Group
 Publication getRandomPublication()
          Returns a Random Publication from the PublicationGroup
 PublicationGroup getRandomPublications(int numElements)
          Returns the specified number of distinct random Publications from the PublicationGroup as a PublicationGroup.
 void initialize(java.util.Collection collection)
          Initializes the group of Publications with the specified Collection
 boolean isSubset(PublicationGroup publication_group)
          Tests whether the specified PublicationGroup is a subset of the current one
 void removeAllPublications()
          Removes all the Publication from the Group
 int size()
          Returns the number of Publications in the Group
 void union(PublicationGroup publicationGroupInterface)
          Modifies the PublicationGroup to be the union of itself and the specified PublicationGroup.
 

Method Detail

initialize

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

Parameters:
collection - Specifies the collection of publications

getPublications

public java.util.Collection getPublications()
Returns the Collection of Publications in the Group

Returns:
the collection of publications in the group

getIterator

public java.util.Iterator getIterator()
Returns the Iterator over the Group of Publications. The Iterator should iterate only over the non-duplicate members of the PublicationGroup. 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 publications

size

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

Returns:
the number of publications in the group

addPublication

public void addPublication(Publication publication)
Adds a Publication to the group

Parameters:
publication - Specifies the publication to be added

removeAllPublications

public void removeAllPublications()
Removes all the Publication from the Group


containsPublication

public boolean containsPublication(Publication publication)
Tests whether the Group contains the Publication or not

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

getRandomPublication

public Publication getRandomPublication()
Returns a Random Publication from the PublicationGroup

Returns:
a random publication from the publication group

getRandomPublications

public PublicationGroup getRandomPublications(int numElements)
Returns the specified number of distinct random Publications from the PublicationGroup as a PublicationGroup. If the specified number is larger than the size of the PublicationGroup, the entire PublicationGroup is returned.

Parameters:
numElements - Specifies the number of publications required
Returns:
the publication group of different random publications

union

public void union(PublicationGroup publicationGroupInterface)
Modifies the PublicationGroup to be the union of itself and the specified PublicationGroup. It acts like the operation (a = a union b), where a is the current PublicationGroup and b is the specified PublicationGroup

Parameters:
publicationGroupInterface - Specifies the publication group to be unioned with

isSubset

public boolean isSubset(PublicationGroup publication_group)
Tests whether the specified PublicationGroup is a subset of the current one

Parameters:
publication_group - Specifies the publication group to be tested
Returns:
true, if publication_group is a subset of the current publication