edu.mit.jmwe.util
Class CompositeCollection<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by edu.mit.jmwe.util.CompositeCollection<E>
Type Parameters:
E - the element type in the collection
All Implemented Interfaces:
Iterable<E>, Collection<E>
Direct Known Subclasses:
MWEDescSet

public class CompositeCollection<E>
extends AbstractCollection<E>

A collection that is composed of several subsets of elements.

Since:
jMWE 1.0.0
Version:
$Id: CompositeCollection.java 555 2011-05-05 19:20:59Z markaf $
Author:
M.A. Finlayson

Nested Class Summary
protected  class CompositeCollection.CompositeCollectionItr
          An iterator over the elements of this composite collection.
 
Field Summary
protected  List<Collection<? extends E>> subsets
           
 
Constructor Summary
CompositeCollection(Collection<? extends E>... subsets)
          Constructs this composite collection from the given array of subsets.
CompositeCollection(Iterable<Collection<? extends E>> subsets)
          Constructs this composite collection from the given collection of subsets.
 
Method Summary
 Iterator<E> iterator()
           
 int size()
           
 
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, 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
equals, hashCode
 

Field Detail

subsets

protected final List<Collection<? extends E>> subsets
Constructor Detail

CompositeCollection

public CompositeCollection(Collection<? extends E>... subsets)
Constructs this composite collection from the given array of subsets.

Parameters:
subsets - the collections containing the elements in this composite collection.
Throws:
NullPointerException - if any of the subsets are null.
IllegalArgumentException - if all of the subsets are empty.
Since:
jMWE 1.0.0

CompositeCollection

public CompositeCollection(Iterable<Collection<? extends E>> subsets)
Constructs this composite collection from the given collection of subsets.

Parameters:
subsets - the collections containing the elements in this composite collection.
Throws:
NullPointerException - if any of the subsets are null.
IllegalArgumentException - if all of the subsets are empty.
Since:
jMWE 1.0.0
Method Detail

size

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

iterator

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


Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.