gov.sandia.cognition.collection
Class DefaultMultiCollection<EntryType>

java.lang.Object
  extended by java.util.AbstractCollection<EntryType>
      extended by gov.sandia.cognition.collection.DefaultMultiCollection<EntryType>
Type Parameters:
EntryType - Type of item stored in this class
All Implemented Interfaces:
MultiCollection<EntryType>, Serializable, Iterable<EntryType>, Collection<EntryType>

@CodeReviews(reviews={@CodeReview(reviewer="Kevin R. Dixon",date="2008-02-08",changesNeeded=false,comments="Looks fine."),@CodeReview(reviewer="Kevin R. Dixon",date="2007-12-10",changesNeeded=false,comments="Minor updates to the javadoc."),@CodeReview(reviewer="Kevin R. Dixon",date="2006-07-18",changesNeeded=false,comments="Looks fine.")})
public class DefaultMultiCollection<EntryType>
extends AbstractCollection<EntryType>
implements Serializable, MultiCollection<EntryType>

The DefaultMultiCollection class implements a Collection that just contains a set of internal collections inside. This allows for easy operations on as set of collections on the same object type.

Since:
1.0
Author:
Justin Basilico
See Also:
Serialized Form

Constructor Summary
DefaultMultiCollection(Collection<? extends Collection<EntryType>> collections)
          Creates a new instance of DefaultMultiCollection.
DefaultMultiCollection(Collection<EntryType> first, Collection<EntryType> second)
          Creates a new instance of DefaultMultiCollection.
 
Method Summary
 boolean contains(Object o)
           
 int getSubCollectionsCount()
          Gets the number of sub-collections in the multi-collection.
 Iterator<EntryType> iterator()
           
 int size()
           
 Collection<? extends Collection<EntryType>> subCollections()
          Returns the sub-collections of the multi-collection.
 
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
add, addAll, clear, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

DefaultMultiCollection

public DefaultMultiCollection(Collection<EntryType> first,
                              Collection<EntryType> second)
Creates a new instance of DefaultMultiCollection.

Parameters:
first - The first collection to add.
second - The second collection to add.

DefaultMultiCollection

public DefaultMultiCollection(Collection<? extends Collection<EntryType>> collections)
Creates a new instance of DefaultMultiCollection.

Parameters:
collections - The Collection of Collections to add.
Method Detail

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<EntryType>
Overrides:
contains in class AbstractCollection<EntryType>

size

public int size()
Specified by:
size in interface Collection<EntryType>
Specified by:
size in class AbstractCollection<EntryType>

getSubCollectionsCount

public int getSubCollectionsCount()
Description copied from interface: MultiCollection
Gets the number of sub-collections in the multi-collection.

Specified by:
getSubCollectionsCount in interface MultiCollection<EntryType>
Returns:
Number of sub-collections in the multi-collection.

iterator

public Iterator<EntryType> iterator()
Specified by:
iterator in interface Iterable<EntryType>
Specified by:
iterator in interface Collection<EntryType>
Specified by:
iterator in class AbstractCollection<EntryType>

subCollections

public Collection<? extends Collection<EntryType>> subCollections()
Description copied from interface: MultiCollection
Returns the sub-collections of the multi-collection.

Specified by:
subCollections in interface MultiCollection<EntryType>
Returns:
The sub-collection of the multi-collection.