org.eclipse.ocl.examples.eventmanager.util
Class CompositeBag<E>

java.lang.Object
  extended by org.eclipse.ocl.examples.eventmanager.CompositeIterable<E>
      extended by org.eclipse.ocl.examples.eventmanager.util.CompositeCollection<E>
          extended by org.eclipse.ocl.examples.eventmanager.util.CompositeBag<E>
All Implemented Interfaces:
java.lang.Iterable<E>, java.util.Collection<E>, Bag<E>

public class CompositeBag<E>
extends CompositeCollection<E>
implements Bag<E>

A Bag implementation that allows for multiple occurrences of elements in the nested collections and allows for them to be counted. In particular, if the nested collections in turn conform to the Bag interface, their count(Object) operation will be used to determine the composite object count.

Author:
Axel Uhl

Constructor Summary
CompositeBag(java.util.Collection<? extends E>... collections)
           
 
Method Summary
 int count(java.lang.Object o)
          Queries how many times the specified object occurs in me.
 
Methods inherited from class org.eclipse.ocl.examples.eventmanager.util.CompositeCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from class org.eclipse.ocl.examples.eventmanager.CompositeIterable
getIterables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

CompositeBag

public CompositeBag(java.util.Collection<? extends E>... collections)
Method Detail

count

public int count(java.lang.Object o)
Description copied from interface: Bag
Queries how many times the specified object occurs in me. If I do not contain the object, then the count is zero.

Specified by:
count in interface Bag<E>
Parameters:
o - an object
Returns:
the number of times that it occurs in me