org.eclipse.ocl.examples.eventmanager.util
Class CompositeCollection<E>
java.lang.Object
org.eclipse.ocl.examples.eventmanager.CompositeIterable<E>
org.eclipse.ocl.examples.eventmanager.util.CompositeCollection<E>
- All Implemented Interfaces:
- java.lang.Iterable<E>, java.util.Collection<E>
- Direct Known Subclasses:
- CompositeBag, CompositeSet
public abstract class CompositeCollection<E>
- extends CompositeIterable<E>
- implements java.util.Collection<E>
Forwards contains(Object)
to the individual sets. Iterates by pulling the iterators of the
individual sets. Just creating the composite set happens in O(1) by assigning the passed array of
sets. The contains-check performs in O(n) is n is the number of sets held by this composite set and
assuming that the individual sets can perform their contains-check in O(1). The composite set is
unmodifiable. All modifying operations throw an exception.
- Author:
- Axel Uhl
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 |
equals, hashCode |
CompositeCollection
public CompositeCollection(java.util.Collection<? extends E>... collections)
CompositeCollection
public CompositeCollection(java.util.Collection<java.lang.Iterable<? extends E>> collections)
contains
public boolean contains(java.lang.Object o)
- Specified by:
contains
in interface java.util.Collection<E>
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAll
in interface java.util.Collection<E>
add
public boolean add(E e)
- Specified by:
add
in interface java.util.Collection<E>
remove
public boolean remove(java.lang.Object o)
- Specified by:
remove
in interface java.util.Collection<E>
addAll
public boolean addAll(java.util.Collection<? extends E> c)
- Specified by:
addAll
in interface java.util.Collection<E>
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAll
in interface java.util.Collection<E>
clear
public void clear()
- Specified by:
clear
in interface java.util.Collection<E>
iterator
public java.util.Iterator<E> iterator()
- Specified by:
iterator
in interface java.lang.Iterable<E>
- Specified by:
iterator
in interface java.util.Collection<E>
- Overrides:
iterator
in class CompositeIterable<E>
size
public int size()
- Specified by:
size
in interface java.util.Collection<E>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface java.util.Collection<E>
toArray
public java.lang.Object[] toArray()
- Specified by:
toArray
in interface java.util.Collection<E>
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray
in interface java.util.Collection<E>
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAll
in interface java.util.Collection<E>