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 anull
element 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 anull
element 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 TypeMethodDescriptionboolean
boolean
addAll
(Collection<? extends E> c) protected void
addListener
(Object listenerType, IObservablesListener listener) void
clear()
protected Object
clone()
protected void
fireEvent
(ObservableEvent event) protected void
getRealm()
protected boolean
protected void
boolean
boolean
removeAll
(Collection<?> c) protected void
removeListener
(Object listenerType, IObservablesListener listener) boolean
retainAll
(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, toString
Methods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addChangeListener, addDisposeListener, addStaleListener, checkRealm, dispose, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface org.eclipse.core.databinding.observable.IObservable
addChangeListener, addDisposeListener, addStaleListener, dispose, getRealm, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
Methods inherited from interface java.util.Set
spliterator
-
Constructor Details
-
WritableSet
public WritableSet()Constructs a new empty instance in the default realm with anull
element 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 anull
element 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:
add
in interfaceCollection<E>
- Specified by:
add
in interfaceIObservableSet<E>
- Specified by:
add
in interfaceSet<E>
- Overrides:
add
in classObservableSet<E>
-
addAll
- Specified by:
addAll
in interfaceCollection<E>
- Specified by:
addAll
in interfaceIObservableSet<E>
- Specified by:
addAll
in interfaceSet<E>
- Overrides:
addAll
in classObservableSet<E>
-
remove
- Specified by:
remove
in interfaceCollection<E>
- Specified by:
remove
in interfaceIObservableSet<E>
- Specified by:
remove
in interfaceSet<E>
- Overrides:
remove
in classObservableSet<E>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<E>
- Specified by:
removeAll
in interfaceIObservableSet<E>
- Specified by:
removeAll
in interfaceSet<E>
- Overrides:
removeAll
in classObservableSet<E>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<E>
- Specified by:
retainAll
in interfaceIObservableSet<E>
- Specified by:
retainAll
in interfaceSet<E>
- Overrides:
retainAll
in classObservableSet<E>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<E>
- Specified by:
clear
in interfaceSet<E>
- Overrides:
clear
in 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:
clone
in classObject
- Throws:
CloneNotSupportedException
-