|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--edu.iu.iv.modeling.tarl.publication.impl.DefaultPublicationGroup
This class defines a default implementation of the PublicationGroupInterface. It stores the group of Publications using a DefaultPublicationGroup.
ExtendedHashSet,
PublicationGroup| Constructor Summary | |
DefaultPublicationGroup()
Creates a new instance of an empty PublicationGroup |
|
DefaultPublicationGroup(PublicationGroup publications)
Creates a new instance for a PublicationGroup as an exact replica of the specified PublicationGroup object |
|
| Method Summary | |
void |
addPublication(Publication publication)
Adds a Publication to the group only if it is not already present in the group |
static boolean |
areSetEqual(PublicationGroup publication_group1,
PublicationGroup publication_group2)
Tests whether the two PublicationGroups are equal or not in terms of Set Equality. |
boolean |
containsPublication(Publication publication)
Tests whether the Group contains the Publication or not |
void |
difference(PublicationGroup publication_group)
Modifies the Group to be the difference of the current PublicationGroup and the specified PublicationGroup. |
static PublicationGroup |
difference(PublicationGroup publication_group1,
PublicationGroup publication_group2)
Returns the difference of the two specified PublicationGroups. |
java.util.Iterator |
getIterator()
Returns the Iterator over the Group of Publications |
java.util.Collection |
getPublications()
Returns the Group of Publications |
Publication |
getRandomPublication()
Returns a Random Publication from the PublicationGroup |
PublicationGroup |
getRandomPublications(int num_elements)
Returns the specified number of different random Publications from the PublicationGroup as a PublicationGroup. |
void |
initialize(java.util.Collection collection)
Initializes the group of Publications with the specified Collection |
void |
intersection(PublicationGroup publication_group)
Modifies the PublicationGroup to be the intersection of the Group and the specified PublicationGroup. |
static PublicationGroup |
intersection(PublicationGroup publication_group1,
PublicationGroup publication_group2)
Returns the intersection of two specified PublicationGroups. |
boolean |
isSubset(PublicationGroup publication_group)
Tests whether the specified PublicationGroup |
static boolean |
isSubset(PublicationGroup publication_group1,
PublicationGroup publication_group2)
Tests whether the PublicationGroup |
void |
removeAllPublications()
Removes all the Publications from the Group |
boolean |
removePublication(Publication publication)
Removes the Publication from the Group |
int |
size()
Returns the number of publications in the Group |
java.lang.String |
toString()
Returns the details of the PublicationGroup as a String |
void |
union(PublicationGroup publication_group)
Modifies the PublicationGroup to be the union of itself and the specified PublicationGroup. |
static PublicationGroup |
union(PublicationGroup publication_group1,
PublicationGroup publication_group2)
Returns the union of two specified PublicationGroups as a PublicationGroup. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public DefaultPublicationGroup()
PublicationGroup
public DefaultPublicationGroup(PublicationGroup publications)
throws java.lang.NullPointerException
PublicationGroup as an exact replica of the specified PublicationGroup object
publications - Specifies the publication group to be replicated
java.lang.NullPointerException - if the parameter publications is null| Method Detail |
public void initialize(java.util.Collection collection)
Publications with the specified Collection
initialize in interface PublicationGroupcollection - Specifies the collection of publicationspublic java.util.Collection getPublications()
Publications
getPublications in interface PublicationGrouppublic java.util.Iterator getIterator()
Iterator over the Group of Publications
getIterator in interface PublicationGrouppublic int size()
size in interface PublicationGrouppublic void addPublication(Publication publication)
Publication to the group only if it is not already present in the group
addPublication in interface PublicationGrouppublication - Specifies the publication to be addedpublic boolean containsPublication(Publication publication)
Publication or not
containsPublication in interface PublicationGrouppublication - Specifies the publication to be tested
public boolean removePublication(Publication publication)
Publication from the Group
publication - Specifies the publication to be removed
public void removeAllPublications()
Publications from the Group
removeAllPublications in interface PublicationGrouppublic Publication getRandomPublication()
Publication from the PublicationGroup
getRandomPublication in interface PublicationGrouppublic PublicationGroup getRandomPublications(int num_elements)
Publications from the PublicationGroup as a PublicationGroup. If the specified number is larger than the size of the PublicationGroup, the entire PublicationGroup is returned.
getRandomPublications in interface PublicationGroupnum_elements - Specifies the number of publications required
public void union(PublicationGroup publication_group)
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
union in interface PublicationGrouppublication_group - Specifies the publication group to be unioned with
public static PublicationGroup union(PublicationGroup publication_group1,
PublicationGroup publication_group2)
PublicationGroups as a PublicationGroup. Does not change any of the PublicationGroups.
publication_group1 - Specifies the first publication grouppublication_group2 - Specifies the second publication group
public void intersection(PublicationGroup publication_group)
PublicationGroup to be the intersection of the Group and the specified PublicationGroup. It acts like the operation (a = a intersection b), where a is the current PublicationGroup and b is the specified PublicationGroup
publication_group - Specifies the publication group to be intersected with
public static PublicationGroup intersection(PublicationGroup publication_group1,
PublicationGroup publication_group2)
PublicationGroups. Does not change any of the PublicationGroups.
publication_group1 - Specifies the first publicationgrouppublication_group2 - Specifies the second publicationgroup
public void difference(PublicationGroup publication_group)
PublicationGroup and the specified PublicationGroup. It acts like the operation (a = a - b), where a is the current PublicationGroup and b is the specified PublicationGroup
- Parameters:
publication_group - Specifies the publication group to be intersected with
public static PublicationGroup difference(PublicationGroup publication_group1,
PublicationGroup publication_group2)
PublicationGroups. Does not change any of the PublicationGroups. The operation can be expressed as (a - b), where a and b are the PublicationGroups as defined by the first and second argument respectively.
publication_group1 - Specifies the first publication grouppublication_group2 - Specifies the second publication group
public boolean isSubset(PublicationGroup publication_group)
PublicationGroup is a subset of the current one
- Specified by:
isSubset in interface PublicationGroup
- Parameters:
publication_group - Specifies the publication group to be tested
- Returns:
- true, if publication_group is a subset of the current publication
public static boolean isSubset(PublicationGroup publication_group1,
PublicationGroup publication_group2)
PublicationGroup specified by the second argument is a subset of the PublicationGroup specified by the first argument
- Parameters:
publication_group1 - Specifies the first publication grouppublication_group2 - Specifies the second publication group
- Returns:
- true, if publication_group2 is a subset of publication_group1
public static boolean areSetEqual(PublicationGroup publication_group1,
PublicationGroup publication_group2)
PublicationGroups are equal or not in terms of Set Equality. Two publicationgroups are Set Equal if first is the subset of the second and the second is a subset of the first.
publication_group1 - Specifies the first publication grouppublication_group2 - Specifies the second publication group
public java.lang.String toString()
PublicationGroup 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 | ||||||||||