E - Type of the elements in this collection.public final class ScopedCollection<E> extends java.lang.Object implements ScopeSubscriber, java.util.Collection<E>
Collection which is scope aware.
This enables the user to store a collection and retrieve these values without taking care about scope changes. The values are always scope aware.
Views onto this collection, like iterating over its elements, will always return those elements from the topmost scope prior to elements from lower scopes.
| Constructor and Description |
|---|
ScopedCollection(ScopeObserver scopeObserver)
Constructs a new object.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e) |
boolean |
addAll(java.util.Collection<? extends E> c) |
void |
clear() |
void |
close()
Unsubscribe this scoped container from the
ScopePublisher. |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
void |
enterScope(Scope previous,
Scope next)
The application has entered the
next scope and the
previous scope is no more the current scope. |
void |
exitScope(Scope previous,
Scope next)
The application has left the
previous scope and the
next scope is valid. |
boolean |
isEmpty() |
java.util.Iterator<E> |
iterator() |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic ScopedCollection(ScopeObserver scopeObserver)
scopeObserver - The current scope observer.public void close()
ScopePublisher.public void enterScope(Scope previous, Scope next)
next scope and the
previous scope is no more the current scope.enterScope in interface ScopeSubscriberprevious - the old scope.next - The new scope.public void exitScope(Scope previous, Scope next)
previous scope and the
next scope is valid.exitScope in interface ScopeSubscriberprevious - the old scope.next - the new scope.public boolean addAll(java.util.Collection<? extends E> c)
addAll in interface java.util.Collection<E>public void clear()
clear in interface java.util.Collection<E>public boolean contains(java.lang.Object o)
contains in interface java.util.Collection<E>public boolean containsAll(java.util.Collection<?> c)
containsAll in interface java.util.Collection<E>public boolean isEmpty()
isEmpty in interface java.util.Collection<E>public java.util.Iterator<E> iterator()
public boolean remove(java.lang.Object o)
remove in interface java.util.Collection<E>public boolean removeAll(java.util.Collection<?> c)
removeAll in interface java.util.Collection<E>public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<E>public int size()
size in interface java.util.Collection<E>public java.lang.Object[] toArray()
toArray in interface java.util.Collection<E>public <T> T[] toArray(T[] a)
toArray in interface java.util.Collection<E>