abstract class BitSet<T> extends java.lang.Object implements ObservableSet<T>
Modifier and Type | Class and Description |
---|---|
private class |
BitSet.Change |
Modifier and Type | Field and Description |
---|---|
private long[] |
bits |
private static long[] |
EMPTY_SET |
private SetListenerHelper<T> |
listenerHelper |
Modifier | Constructor and Description |
---|---|
protected |
BitSet()
Create an empty set of T
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T t) |
boolean |
addAll(java.util.Collection<? extends T> c) |
void |
addListener(InvalidationListener invalidationListener)
Adds an
InvalidationListener which will be notified whenever the
Observable becomes invalid. |
void |
addListener(SetChangeListener<? super T> setChangeListener)
Add a listener to this observable set.
|
protected abstract T |
cast(java.lang.Object o) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
boolean |
equals(java.lang.Object obj) |
protected long[] |
getBits() |
protected abstract int |
getIndex(T t) |
protected abstract T |
getT(int index) |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator()
This returned iterator is not fail-fast.
|
private void |
notifyObservers(T element,
boolean removed) |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
void |
removeListener(InvalidationListener invalidationListener)
Removes the given listener from the list of listeners, that are notified
whenever the value of the
Observable becomes invalid. |
void |
removeListener(SetChangeListener<? super T> setChangeListener)
Tries to removed a listener from this observable set.
|
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
private static final long[] EMPTY_SET
private long[] bits
private SetListenerHelper<T> listenerHelper
public int size()
public boolean isEmpty()
public java.util.Iterator<T> iterator()
public boolean add(T t)
public boolean remove(java.lang.Object o)
public boolean contains(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
public boolean addAll(java.util.Collection<? extends T> c)
public boolean retainAll(java.util.Collection<?> c)
public boolean removeAll(java.util.Collection<?> c)
public void clear()
public int hashCode()
public boolean equals(java.lang.Object obj)
protected abstract T getT(int index)
protected abstract int getIndex(T t)
protected abstract T cast(java.lang.Object o)
protected long[] getBits()
public void addListener(SetChangeListener<? super T> setChangeListener)
ObservableSet
addListener
in interface ObservableSet<T>
setChangeListener
- the listener for listening to the set changespublic void removeListener(SetChangeListener<? super T> setChangeListener)
ObservableSet
removeListener
in interface ObservableSet<T>
setChangeListener
- a listener to removepublic void addListener(InvalidationListener invalidationListener)
Observable
InvalidationListener
which will be notified whenever the
Observable
becomes invalid. If the same
listener is added more than once, then it will be notified more than
once. That is, no check is made to ensure uniqueness.
Note that the same actual InvalidationListener
instance may be
safely registered for different Observables
.
The Observable
stores a strong reference to the listener
which will prevent the listener from being garbage collected and may
result in a memory leak. It is recommended to either unregister a
listener by calling removeListener
after use or to use an instance of
WeakInvalidationListener
avoid this situation.
addListener
in interface Observable
invalidationListener
- The listener to registerObservable.removeListener(InvalidationListener)
public void removeListener(InvalidationListener invalidationListener)
Observable
Observable
becomes invalid.
If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.
removeListener
in interface Observable
invalidationListener
- The listener to removeObservable.addListener(InvalidationListener)
private void notifyObservers(T element, boolean removed)