Class WritableSet<E>
java.lang.Object
org.eclipse.core.databinding.observable.AbstractObservable
org.eclipse.core.databinding.observable.set.ObservableSet<E>
org.eclipse.core.databinding.observable.set.WritableSet<E>
- Type Parameters:
E- the type of elements in this set
- All Implemented Interfaces:
Iterable<E>,Collection<E>,Set<E>,IObservable,IObservableCollection<E>,IObservableSet<E>
Mutable (writable) implementation of
IObservableSet.
This class is thread safe. All state accessing methods must be invoked from
the current realm. Methods for adding and removing
listeners may be invoked from any thread.
- Since:
- 1.0
-
Field Summary
Fields inherited from class org.eclipse.core.databinding.observable.set.ObservableSet
elementType, wrappedSet -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new empty instance in the default realm with anullelement type.WritableSet(Collection<? extends E> c, Object elementType) Constructs a new instance in the default realm containing the elements of the given collection.WritableSet(Realm realm) Constructs a new empty instance in the given realm and anullelement type.WritableSet(Realm realm, Collection<? extends E> c, Object elementType) Constructs a new instance in the default realm with the given element type, containing the elements of the given collection. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends E> c) protected voidaddListener(Object listenerType, IObservablesListener listener) voidclear()protected Objectclone()protected voidfireEvent(ObservableEvent event) protected voidgetRealm()protected booleanprotected voidbooleanbooleanremoveAll(Collection<?> c) protected voidremoveListener(Object listenerType, IObservablesListener listener) booleanretainAll(Collection<?> c) static <E> WritableSet<E> withElementType(Object elementType) Methods inherited from class org.eclipse.core.databinding.observable.set.ObservableSet
addSetChangeListener, contains, containsAll, equals, fireChange, fireSetChange, getElementType, getterCalled, hashCode, isEmpty, isStale, iterator, removeSetChangeListener, setStale, setWrappedSet, size, toArray, toArray, toStringMethods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addChangeListener, addDisposeListener, addStaleListener, checkRealm, dispose, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListenerMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface org.eclipse.core.databinding.observable.IObservable
addChangeListener, addDisposeListener, addStaleListener, dispose, getRealm, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListenerMethods inherited from interface java.util.Set
spliterator
-
Constructor Details
-
WritableSet
public WritableSet()Constructs a new empty instance in the default realm with anullelement type. -
WritableSet
Constructs a new instance in the default realm containing the elements of the given collection. Changes to the given collection after calling this method do not affect the contents of the created WritableSet.- Parameters:
c- elements to initialize this set withelementType- can benull
-
WritableSet
Constructs a new empty instance in the given realm and anullelement type.- Parameters:
realm- the realm
-
WritableSet
Constructs a new instance in the default realm with the given element type, containing the elements of the given collection. Changes to the given collection after calling this method do not affect the contents of the created WritableSet.- Parameters:
realm- the realmc- elements to initialize this set withelementType- can benull
-
-
Method Details
-
add
- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceIObservableSet<E>- Specified by:
addin interfaceSet<E>- Overrides:
addin classObservableSet<E>
-
addAll
- Specified by:
addAllin interfaceCollection<E>- Specified by:
addAllin interfaceIObservableSet<E>- Specified by:
addAllin interfaceSet<E>- Overrides:
addAllin classObservableSet<E>
-
remove
- Specified by:
removein interfaceCollection<E>- Specified by:
removein interfaceIObservableSet<E>- Specified by:
removein interfaceSet<E>- Overrides:
removein classObservableSet<E>
-
removeAll
- Specified by:
removeAllin interfaceCollection<E>- Specified by:
removeAllin interfaceIObservableSet<E>- Specified by:
removeAllin interfaceSet<E>- Overrides:
removeAllin classObservableSet<E>
-
retainAll
- Specified by:
retainAllin interfaceCollection<E>- Specified by:
retainAllin interfaceIObservableSet<E>- Specified by:
retainAllin interfaceSet<E>- Overrides:
retainAllin classObservableSet<E>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<E>- Specified by:
clearin interfaceSet<E>- Overrides:
clearin classObservableSet<E>
-
withElementType
- Parameters:
elementType- can benull- Returns:
- new instance with the default realm
-
addListener
- Parameters:
listenerType- arbitrary object to identify a type of the listenerlistener- the listener to add; notnull
-
removeListener
- Parameters:
listenerType- arbitrary object to identify a type of the listenerlistener- the listener to remove; notnull
-
hasListeners
protected boolean hasListeners() -
fireEvent
-
firstListenerAdded
protected void firstListenerAdded() -
lastListenerRemoved
protected void lastListenerRemoved() -
getRealm
- Returns:
- Returns the realm.
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-